系统是win10、python3.8.2
安装Python_snappy时报错 Microsoft Visual C++ 14.0 is require
安装Microsoft Visual C++ Build Tools之后又出现报错:
C:\Users\sesa542092>python -m pip install pymongo[snappy] Requirement already satisfied: pymongo[snappy] in c:\users\sesa542092\appdata\local\programs\python\python38-32\lib\site-packages (3.11.0) Collecting python-snappy; extra == "snappy" Using cached python-snappy-0.5.4.tar.gz (21 kB) Using legacy setup.py install for python-snappy, since package 'wheel' is not installed. Installing collected packages: python-snappy Running setup.py install for python-snappy ... error ERROR: Command errored out with exit status 1: command: 'C:\Users\sesa542092\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sesa542092\\AppData\\Local\\Temp\\pip-install-94jbnbnl\\python-snappy\\setup.py'"'"'; __file__='"'"'C:\\Users\\sesa542092\\AppData\\Local\\Temp\\pip-install-94jbnbnl\\python-snappy\\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\sesa542092\AppData\Local\Temp\pip-record-8m6z8dog\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\sesa542092\AppData\Local\Programs\Python\Python38-32\Include\python-snappy' cwd: C:\Users\sesa542092\AppData\Local\Temp\pip-install-94jbnbnl\python-snappy\ Complete output (22 lines): running install running build running build_py creating build creating build\lib.win32-3.8 creating build\lib.win32-3.8\snappy copying snappy\hadoop_snappy.py -> build\lib.win32-3.8\snappy copying snappy\snappy.py -> build\lib.win32-3.8\snappy copying snappy\snappy_cffi.py -> build\lib.win32-3.8\snappy copying snappy\snappy_cffi_builder.py -> build\lib.win32-3.8\snappy copying snappy\snappy_formats.py -> build\lib.win32-3.8\snappy copying snappy\__init__.py -> build\lib.win32-3.8\snappy copying snappy\__main__.py -> build\lib.win32-3.8\snappy running build_ext building 'snappy._snappy' extension creating build\temp.win32-3.8 creating build\temp.win32-3.8\Release creating build\temp.win32-3.8\Release\snappy C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\sesa542092\AppData\Local\Programs\Python\Python38-32\include -IC:\Users\sesa542092\AppData\Local\Programs\Python\Python38-32\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 /Tpsnappy/snappymodule.cc /Fobuild\temp.win32-3.8\Release\snappy/snappymodule.obj snappymodule.cc snappy/snappymodule.cc(31): fatal error C1083: Cannot open include file: 'snappy-c.h': No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2 ---------------------------------------- ERROR: Command errored out with exit status 1: 'C:\Users\sesa542092\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, t
okenize; sys.argv[0] = '"'"'C:\\Users\\sesa542092\\AppData\\Local\\Temp\\pip-install-94jbnbnl\\python-snappy\\setup.py'"'"'; __file__='"'"'C:\\Users\\sesa542092\\AppData\\Local\\Temp\\pip-install-94jbnbnl\\python-snappy\\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\sesa542092\AppData\Local\Temp\pip-record-8m6z8dog\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\sesa542092\AppData\Local\Programs\Python\Python38-32\Include\python-snappy' Check the logs for full command output.
百度之后发现需要安装一个文件
打开https://www.lfd.uci.edu/~gohlke/pythonlibs/
查看自己Python版本是3.8,对应cp38
下载的python_snappy-0.5.4-cp38-cp38-win32.whl
终端pip install python_snappy-0.5.4-cp38-cp38-win32.whl
解决
以上。