我正在使用VScode和py3.7。
我尝试下载python-Levenshtein:通过使用pip install python-Levenshtein
但是,我有一个错误。 (命令“ cl.exe”失败:没有这样的文件或目录)
我试图将cl.exe添加到PATH,下载了Visual Studio Build Tools 2019和C ++生成工具,以按照某些人的说法解决此问题。
所有尝试均失败。
error
ERROR: Command errored out with exit status 1:
command: 'c:\program files (x86)\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ERDICA~1\\AppData\\Local\\Temp\\pip-install-y9n1vy89\\python-Levenshtein\\setup.py'"'"'; __file__='"'"'C:\\Users\\ERDICA~1\\AppData\\Local\\Temp\\pip-install-y9n1vy89\\python-Levenshtein\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\ERDICA~1\AppData\Local\Temp\pip-wheel-misp6ye9'
cwd: C:\Users\ERDICA~1\AppData\Local\Temp\pip-install-y9n1vy89\python-Levenshtein\
Complete output (31 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\Levenshtein
copying Levenshtein\StringMatcher.py -> build\lib.win32-3.7\Levenshtein
copying Levenshtein\__init__.py -> build\lib.win32-3.7\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.win32-3.7\Levenshtein
copying Levenshtein\_levenshtein.h -> build\lib.win32-3.7\Levenshtein
running build_ext
building 'Levenshtein._levenshtein' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
error
ERROR: Command errored out with exit status 1:
command: 'c:\program files (x86)\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ERDICA~1\\AppData\\Local\\Temp\\pip-install-y9n1vy89\\python-Levenshtein\\setup.py'"'"'; __file__='"'"'C:\\Users\\ERDICA~1\\AppData\\Local\\Temp\\pip-install-y9n1vy89\\python-Levenshtein\\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\ERDICA~1\AppData\Local\Temp\pip-record-n5v50174\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Erdi Can\AppData\Roaming\Python\Python37\Include\python-Levenshtein'
cwd: C:\Users\ERDICA~1\AppData\Local\Temp\pip-install-y9n1vy89\python-Levenshtein\
Complete output (31 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\Levenshtein
copying Levenshtein\StringMatcher.py -> build\lib.win32-3.7\Levenshtein
copying Levenshtein\__init__.py -> build\lib.win32-3.7\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.win32-3.7\Levenshtein
copying Levenshtein\_levenshtein.h -> build\lib.win32-3.7\Levenshtein
running build_ext
building 'Levenshtein._levenshtein' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\Levenshtein
cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-Ic:\program files (x86)\python37-32\include" "-Ic:\program files (x86)\python37-32\include" /TcLevenshtein/_levenshtein.c /Fobuild\temp.win32-3.7\Release\Levenshtein/_levenshtein.obj
error: command 'cl.exe' failed: No such file or directory
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files (x86)\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ERDICA~1\\AppData\\Local\\Temp\\pip-install-y9n1vy89\\python-Levenshtein\\setup.py'"'"'; __file__='"'"'C:\\Users\\ERDICA~1\\AppData\\Local\\Temp\\pip-install-y9n1vy89\\python-Levenshtein\\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\ERDICA~1\AppData\Local\Temp\pip-record-n5v50174\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Erdi Can\AppData\Roaming\Python\Python37\Include\python-Levenshtein' Check the logs for full command output.
我该如何解决这个问题?
答案 0 :(得分:0)
尝试使用滚轮版本安装它
pip install python-Levenshtein-wheels
安装后,我尝试了这段代码
import Levenshtein
name1 = 'ahmed'
name2 = 'ahmad'
print( Levenshtein.distance(name1, name2))
并获得
1