我正在尝试使用“ Thonny IDE”工具安装pygrib软件包来管理软件包,但出现此错误:
Collecting pygrib
Downloading
https://files.pythonhosted.org/packages/a1/b3/04bd9b0e9f19ca7195e33975da7004602b 6abed3c48b779a06332e197e60/pygrib-2.0.3.tar.gz (21.4MB)
Installing collected packages: pygrib
Running setup.py install for pygrib: started
Running setup.py install for pygrib: finished with status 'error'
Complete output from command C:\Users\SSQ1\.thonny\BundledPython36\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SSQ1\\AppData\\Local\\Temp\\pip-install-b71fvftx\\pygrib\\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\SSQ1\AppData\Local\Temp\pip-record-x9xj51sk\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\SSQ1\.thonny\BundledPython36\include\site\python3.6\pygrib:
running install
running build
running build_py
creating build
creating build\lib.win32-3.6
copying ncepgrib2.py -> build\lib.win32-3.6
running build_ext
building 'pygrib' extension
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\SSQ1\.thonny\BundledPython36\lib\site-packages\numpy\core\include -Ig2clib_src -IC:\Users\SSQ1\.thonny\BundledPython36\include -IC:\Users\SSQ1\AppData\Local\Programs\Thonny\include -IC:\Users\SSQ1\AppData\Local\Programs\Thonny\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcpygrib.c /Fobuild\temp.win32-3.6\Release\pygrib.obj
pygrib.c
pygrib.c(4): fatal error C1083: Non Å possibile aprire il file inclusione: 'Python.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
Command "C:\Users\SSQ1\.thonny\BundledPython36\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SSQ1\\AppData\\Local\\Temp\\pip-install-b71fvftx\\pygrib\\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\SSQ1\AppData\Local\Temp\pip- record-x9xj51sk\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\SSQ1\.thonny\BundledPython36\include\site\python3.6\pygrib" failed with error code 1 in C:\Users\SSQ1\AppData\Local\Temp\pip-install-b71fvftx\pygrib\
Return code:
我知道它无法在正确的路径中找到“ Python.h”,但我无法理解“哪一个是正确的”。
很抱歉,没有更多信息,但是我使用python的时间很少
答案 0 :(得分:0)
Thonny内置的Python解释器不包含用于从源代码构建本机软件包所需的文件。换句话说,您无法使用Thonny的内置Python安装此软件包。
您应该从python.org安装一个单独的Python,并让Thonny将其用作后端(工具=>选项=>解释器)。之后,您应该能够安装此软件包(前提是您已正确设置了Visual Studio Tools)。