在Windows10上安装外部库出错

2024-05-18 13:57:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试安装压缩包(https://pypi.org/project/contractions/),但是这个错误不断出现。 尝试安装微软Visual C++,但它只下载一个安装程序,然后我找不到具体的东西。有人能帮我弄清楚吗?你知道吗

编辑:我显然也尝试了pip install contractionswheel文档。你知道吗

C:\Users\CatKa\Documents\MSc\MACHINE LEARNING>python -m pip install contractions
Collecting contractions
  Using cached https://files.pythonhosted.org/packages/85/41/c3dfd5feb91a8d587ed1a59f553f07c05f95ad4e5d00ab78702fbf8fe48a/contractions-0.0.24-py2.py3-none-any.whl
Collecting textsearch
  Using cached https://files.pythonhosted.org/packages/42/a8/03407021f9555043de5492a2bd7a35c56cc03c2510092b5ec018cae1bbf1/textsearch-0.0.17-py2.py3-none-any.whl
Collecting pyahocorasick
  Using cached https://files.pythonhosted.org/packages/f4/9f/f0d8e8850e12829eea2e778f1c90e3c53a9a799b7f412082a5d21cd19ae1/pyahocorasick-1.4.0.tar.gz
Requirement already satisfied: Unidecode in c:\users\catka\anaconda3\lib\site-packages (from textsearch->contractions) (1.1.1)
Building wheels for collected packages: pyahocorasick
  Building wheel for pyahocorasick (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\CatKa\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-5amje9u5\\pyahocorasick\\setup.py'"'"'; __file__='"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-5amje9u5\\pyahocorasick\\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\CatKa\AppData\Local\Temp\pip-wheel-ky0_mxbr' --python-tag cp37
       cwd: C:\Users\CatKa\AppData\Local\Temp\pip-install-5amje9u5\pyahocorasick\
  Complete output (5 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'ahocorasick' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
  ----------------------------------------
  ERROR: Failed building wheel for pyahocorasick
  Running setup.py clean for pyahocorasick
Failed to build pyahocorasick
Installing collected packages: pyahocorasick, textsearch, contractions
    Running setup.py install for pyahocorasick ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\CatKa\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-5amje9u5\\pyahocorasick\\setup.py'"'"'; __file__='"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-5amje9u5\\pyahocorasick\\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\CatKa\AppData\Local\Temp\pip-record-69ndyre4\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\CatKa\AppData\Local\Temp\pip-install-5amje9u5\pyahocorasick\
    Complete output (5 lines):
    running install
    running build
    running build_ext
    building 'ahocorasick' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\CatKa\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-5amje9u5\\pyahocorasick\\setup.py'"'"'; __file__='"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-5amje9u5\\pyahocorasick\\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\CatKa\AppData\Local\Temp\pip-record-69ndyre4\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

编辑2: 安装Visual C++,如它所说的(https://www.scivision.co/python-windows-visual-c-14-required/),并且还安装了VisualC++ 14,这里提供的(Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat))但是现在错误部分甚至更大

C:\Users\CatKa\Documents\MSc\MACHINE LEARNING>pip install contractions
Collecting contractions
  Using cached https://files.pythonhosted.org/packages/85/41/c3dfd5feb91a8d587ed1a59f553f07c05f95ad4e5d00ab78702fbf8fe48a/contractions-0.0.24-py2.py3-none-any.whl
Collecting textsearch
  Using cached https://files.pythonhosted.org/packages/42/a8/03407021f9555043de5492a2bd7a35c56cc03c2510092b5ec018cae1bbf1/textsearch-0.0.17-py2.py3-none-any.whl
Requirement already satisfied: Unidecode in c:\users\catka\anaconda3\lib\site-packages (from textsearch->contractions) (1.1.1)
Collecting pyahocorasick
  Using cached https://files.pythonhosted.org/packages/f4/9f/f0d8e8850e12829eea2e778f1c90e3c53a9a799b7f412082a5d21cd19ae1/pyahocorasick-1.4.0.tar.gz
Building wheels for collected packages: pyahocorasick
  Building wheel for pyahocorasick (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\catka\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-nx9373pl\\pyahocorasick\\setup.py'"'"'; __file__='"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-nx9373pl\\pyahocorasick\\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\CatKa\AppData\Local\Temp\pip-wheel-mg8rchse' --python-tag cp37
       cwd: C:\Users\CatKa\AppData\Local\Temp\pip-install-nx9373pl\pyahocorasick\
  Complete output (23 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'ahocorasick' extension
  creating build
  creating build\temp.win-amd64-3.7
  creating build\temp.win-amd64-3.7\Release
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DAHOCORASICK_UNICODE= -Ic:\users\catka\anaconda3\include -Ic:\users\catka\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" /Tcpyahocorasick.c /Fobuild\temp.win-amd64-3.7\Release\pyahocorasick.obj
  pyahocorasick.c
  c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\Automaton_pickle.c(363): warning C4018: '<': signed/unsigned mismatch
  c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\Automaton_pickle.c(422): warning C4018: '<': signed/unsigned mismatch
  c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\Automaton_pickle.c(473): warning C4018: '<': signed/unsigned mismatch
  c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\Automaton_pickle.c(483): warning C4018: '<': signed/unsigned mismatch
  c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\src/custompickle/load/loadbuffer.c(68): warning C4146: unary minus operator applied to unsigned type, result still unsigned
  c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\src/custompickle/load/module_automaton_load.c(89): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
  creating C:\Users\CatKa\AppData\Local\Temp\pip-install-nx9373pl\pyahocorasick\build\lib.win-amd64-3.7
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\users\catka\anaconda3\libs /LIBPATH:c:\users\catka\anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" /EXPORT:PyInit_ahocorasick build\temp.win-amd64-3.7\Release\pyahocorasick.obj /OUT:build\lib.win-amd64-3.7\ahocorasick.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\ahocorasick.cp37-win_amd64.lib
  pyahocorasick.obj : warning LNK4197: export 'PyInit_ahocorasick' specified multiple times; using first specification
     Creating library build\temp.win-amd64-3.7\Release\ahocorasick.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\ahocorasick.cp37-win_amd64.exp
  Generating code
  Finished generating code
  LINK : fatal error LNK1158: cannot run 'rc.exe'
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158
  ----------------------------------------
  ERROR: Failed building wheel for pyahocorasick
  Running setup.py clean for pyahocorasick
Failed to build pyahocorasick
Installing collected packages: pyahocorasick, textsearch, contractions
    Running setup.py install for pyahocorasick ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\catka\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-nx9373pl\\pyahocorasick\\setup.py'"'"'; __file__='"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-nx9373pl\\pyahocorasick\\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\CatKa\AppData\Local\Temp\pip-record-82y3clbc\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\CatKa\AppData\Local\Temp\pip-install-nx9373pl\pyahocorasick\
    Complete output (23 lines):
    running install
    running build
    running build_ext
    building 'ahocorasick' extension
    creating build
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DAHOCORASICK_UNICODE= -Ic:\users\catka\anaconda3\include -Ic:\users\catka\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" /Tcpyahocorasick.c /Fobuild\temp.win-amd64-3.7\Release\pyahocorasick.obj
    pyahocorasick.c
    c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\Automaton_pickle.c(363): warning C4018: '<': signed/unsigned mismatch
    c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\Automaton_pickle.c(422): warning C4018: '<': signed/unsigned mismatch
    c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\Automaton_pickle.c(473): warning C4018: '<': signed/unsigned mismatch
    c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\Automaton_pickle.c(483): warning C4018: '<': signed/unsigned mismatch
    c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\src/custompickle/load/loadbuffer.c(68): warning C4146: unary minus operator applied to unsigned type, result still unsigned
    c:\users\catka\appdata\local\temp\pip-install-nx9373pl\pyahocorasick\src/custompickle/load/module_automaton_load.c(89): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
    creating C:\Users\CatKa\AppData\Local\Temp\pip-install-nx9373pl\pyahocorasick\build\lib.win-amd64-3.7
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\users\catka\anaconda3\libs /LIBPATH:c:\users\catka\anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" /EXPORT:PyInit_ahocorasick build\temp.win-amd64-3.7\Release\pyahocorasick.obj /OUT:build\lib.win-amd64-3.7\ahocorasick.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\ahocorasick.cp37-win_amd64.lib
    pyahocorasick.obj : warning LNK4197: export 'PyInit_ahocorasick' specified multiple times; using first specification
       Creating library build\temp.win-amd64-3.7\Release\ahocorasick.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\ahocorasick.cp37-win_amd64.exp
    Generating code
    Finished generating code
    LINK : fatal error LNK1158: cannot run 'rc.exe'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\catka\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-nx9373pl\\pyahocorasick\\setup.py'"'"'; __file__='"'"'C:\\Users\\CatKa\\AppData\\Local\\Temp\\pip-install-nx9373pl\\pyahocorasick\\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\CatKa\AppData\Local\Temp\pip-record-82y3clbc\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

Tags: installpipbuildlocalwinusersappdatatemp

热门问题