[调试]python3.8 + win10 安装 python-Levenshtein 失败

张博涛
2023-12-01

安装失败

C:\Users\86189\Downloads>pip install python_Levenshtein
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting python_Levenshtein
  Downloading http://mirrors.aliyun.com/pypi/packages/42/a9/d1785c85ebf9b7dfacd08938dd028209c34a0ea3b1bcdb895208bd40a67d/python-Levenshtein-0.12.0.tar.gz (48 kB)
     |████████████████████████████████| 48 kB 217 kB/s
Requirement already satisfied: setuptools in c:\users\86189\appdata\local\programs\python\python38\lib\site-packages (from python_Levenshtein) (41.2.0)
Using legacy 'setup.py install' for python-Levenshtein, since package 'wheel' is not installed.
Installing collected packages: python-Levenshtein
    Running setup.py install for python-Levenshtein ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\86189\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\86189\\AppData\\Local\\Temp\\pip-install-_l1_xc57\\python-levenshtein_d9e121bf59e447e783daa9bc014891f0\\setup.py'"'"'; __file__='"'"'C:\\Users\\86189\\AppData\\Local\\Temp\\pip-install-_l1_xc57\\python-levenshtein_d9e121bf59e447e783daa9bc014891f0\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\86189\AppData\Local\Temp\pip-record-qikhq1um\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\86189\appdata\local\programs\python\python38\Include\python-Levenshtein'
         cwd: C:\Users\86189\AppData\Local\Temp\pip-install-_l1_xc57\python-levenshtein_d9e121bf59e447e783daa9bc014891f0\
    Complete output (27 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\Levenshtein
    copying Levenshtein\StringMatcher.py -> build\lib.win-amd64-3.8\Levenshtein
    copying Levenshtein\__init__.py -> build\lib.win-amd64-3.8\Levenshtein
    running egg_info
    writing python_Levenshtein.egg-info\PKG-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 requirements to python_Levenshtein.egg-info\requires.txt
    writing top-level names to python_Levenshtein.egg-info\top_level.txt
    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.win-amd64-3.8\Levenshtein
    copying Levenshtein\_levenshtein.h -> build\lib.win-amd64-3.8\Levenshtein
    running build_ext
    building 'Levenshtein._levenshtein' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\86189\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\86189\\AppData\\Local\\Temp\\pip-install-_l1_xc57\\python-levenshtein_d9e121bf59e447e783daa9bc014891f0\\setup.py'"'"'; __file__='"'"'C:\\Users\\86189\\AppData\\Local\\Temp\\pip-install-_l1_xc57\\python-levenshtein_d9e121bf59e447e783daa9bc014891f0\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\86189\AppData\Local\Temp\pip-record-qikhq1um\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\86189\appdata\local\programs\python\python38\Include\python-Levenshtein' Check the logs for full command output.

安装方法

直接下载 .whl 文件,直接安装

python_Levenshtein‑0.12.0‑cp38‑cp38m‑win_amd64.whl

这个网站上面全是已经预编译好的python包(whl文件),可以直接进行安装,比如对于python-levenshtein,网址:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-levenshtein

注意选择whl文件的python版本(cp)以及平台(win32/amd64),都可以通过“python”指令查看到;这里平台(64/32)是指python,而不是操作系统的平台类型,32bit的python既可以装在32bit操作系统,可以装在64bit操作系统。

 类似资料: