首页 > 解决方案 > 无法使用 pip 安装 python-Levenshtein

问题描述

操作系统是Windows 7 Service Pack 1

python版本是3.5.0

点子版本是7.1.2

包链接是https://pypi.org/project/python-Levenshtein/,根据该链接“需要 Python 2.2 或更新版本;支持 Python 3。”

命令是pip install python-Levenshtein

下面的输出:

C:\Users\HP> pip install python-Levenshtein

Collecting python-Levenshtein
  Using cached https://files.pythonhosted.org/packages/2a/dc/97f2b63ef0fa1fd78dcb7195aca577804f6b2b51e712516cc0e902a9a201/python-Levenshtein-0.12.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\program files (x86)\python 3.5\lib\site-packages (from python-Levenshtein)
Installing collected packages: python-Levenshtein
  Running setup.py install for python-Levenshtein
    Complete output from command "c:\program files (x86)\python 3.5\python.exe" -c "import setuptools, tokenize;__file__='C:\\Users\\HP\\AppData\\Local\\Temp\\pip-build-tdu_iv0a\\python-Levenshtein\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\HP\AppData\Local\Temp\pip-9i8823r1-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.5
    creating build\lib.win32-3.5\Levenshtein
    copying Levenshtein\StringMatcher.py -> build\lib.win32-3.5\Levenshtein
    copying Levenshtein\__init__.py -> build\lib.win32-3.5\Levenshtein
    running egg_info
    writing dependency_links to python_Levenshtein.egg-info\dependency_links.txt
    writing entry points to python_Levenshtein.egg-info\entry_points.txt
    writing namespace_packages to python_Levenshtein.egg-info\namespace_packages.txt
    writing python_Levenshtein.egg-info\PKG-INFO
    writing top-level names to python_Levenshtein.egg-info\top_level.txt
    writing requirements to python_Levenshtein.egg-info\requires.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files matching '*pyc' found anywhere in distribution
    warning: no previously-included files matching '*so' found anywhere in distribution
    warning: no previously-included files matching '.project' found anywhere in distribution
    warning: no previously-included files matching '.pydevproject' found anywhere in distribution
    writing manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
    copying Levenshtein\_levenshtein.c -> build\lib.win32-3.5\Levenshtein
    copying Levenshtein\_levenshtein.h -> build\lib.win32-3.5\Levenshtein
    running build_ext
    building 'Levenshtein._levenshtein' extension
    error: [WinError 2] The system cannot find the file specified

    ----------------------------------------
Command ""c:\program files (x86)\python 3.5\python.exe" -c "import setuptools, tokenize;__file__='C:\\Users\\HP\\AppData\\Local\\Temp\\pip-build-tdu_iv0a\\python-Levenshtein\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\HP\AppData\Local\Temp\pip-9i8823r1-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\HP\AppData\Local\Temp\pip-build-tdu_iv0a\python-Levenshtein
You are using pip version 7.1.2, however version 21.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\HP>

我以前安装过软件包,但无法弄清楚。有人可能会说这个问题已经在这里回答了为什么我不能在 Windows Python 3.8.1 上安装 Levenshtein 包?但是在那种情况下,输出告诉 install Visual Studio C++ 14.0,在我的情况下它没有。

我提供的包链接说它是 C 模块,而不是 C++。Idk,可能与 python 3.5(我正在使用的版本)不同,Visual Studio C++ 14.0python 3.8 需要它来安装包。即使它们是 C 而不是 C++。

请帮助我理解这类问题,这样我以后就不会陷入困境。

标签: pythonpython-3.xpip

解决方案


推荐阅读