python 安装第三方库弹出如下错误,在网络上找了很多方法都没有解决。
C:\Users\EDY>pip install cchardet
Collecting cchardet
Using cached cchardet-2.1.7.tar.gz (653 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: cchardet
Building wheel for cchardet (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-311
creating build\lib.win-amd64-cpython-311\cchardet
copying src\cchardet\version.py -> build\lib.win-amd64-cpython-311\cchardet
copying src\cchardet\__init__.py -> build\lib.win-amd64-cpython-311\cchardet
running build_ext
building 'cchardet._cchardet' extension
creating build\temp.win-amd64-cpython-311
creating build\temp.win-amd64-cpython-311\Release
creating build\temp.win-amd64-cpython-311\Release\src
creating build\temp.win-amd64-cpython-311\Release\src\cchardet
creating build\temp.win-amd64-cpython-311\Release\src\ext
creating build\temp.win-amd64-cpython-311\Release\src\ext\uchardet
creating build\temp.win-amd64-cpython-311\Release\src\ext\uchardet\src
creating build\temp.win-amd64-cpython-311\Release\src\ext\uchardet\src\LangModels
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Isrc/ext/uchardet/src -IC:\Users\EDY\AppData\Local\Programs\Python\Python311\include -IC:\Users\EDY\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /EHsc /Tpsrc/cchardet\_cchardet.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src/cchardet\_cchardet.obj
_cchardet.cpp
src/cchardet\_cchardet.cpp(196): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cchardet
Running setup.py clean for cchardet
Failed to build cchardet
Installing collected packages: cchardet
Running setup.py install for cchardet ... error
error: subprocess-exited-with-error
× Running setup.py install for cchardet did not run successfully.
│ exit code: 1
╰─> [24 lines of output]
running install
C:\Users\EDY\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-311
creating build\lib.win-amd64-cpython-311\cchardet
copying src\cchardet\version.py -> build\lib.win-amd64-cpython-311\cchardet
copying src\cchardet\__init__.py -> build\lib.win-amd64-cpython-311\cchardet
running build_ext
building 'cchardet._cchardet' extension
creating build\temp.win-amd64-cpython-311
creating build\temp.win-amd64-cpython-311\Release
creating build\temp.win-amd64-cpython-311\Release\src
creating build\temp.win-amd64-cpython-311\Release\src\cchardet
creating build\temp.win-amd64-cpython-311\Release\src\ext
creating build\temp.win-amd64-cpython-311\Release\src\ext\uchardet
creating build\temp.win-amd64-cpython-311\Release\src\ext\uchardet\src
creating build\temp.win-amd64-cpython-311\Release\src\ext\uchardet\src\LangModels
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Isrc/ext/uchardet/src -IC:\Users\EDY\AppData\Local\Programs\Python\Python311\include -IC:\Users\EDY\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /EHsc /Tpsrc/cchardet\_cchardet.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src/cchardet\_cchardet.obj
_cchardet.cpp
src/cchardet\_cchardet.cpp(196): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> cchardet
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.