pip 安装包 - 失败,错误代码为 1/2

pip install package - failed with error code 1/2

我在使用 pip 安装 pygrib 时遇到问题。我尝试使用 easy_install 安装 pygrib,但出现了类似的错误。

使用 pip 我得到这个错误:

Command "C:\Users\Brandon\AppData\Local\Enthought\Canopy\edm\envs\User\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\Brandon\AppData\Local\Temp\pip-build-veulay9n\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\Brandon\AppData\Local\Temp\pip-ff_s5247-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Brandon\AppData\Local\Temp\pip-build-veulay9n\pygrib\

使用 easy_install 我得到这个错误:

c:\users\brandon\appdata\local\enthought\canopy\edm\envs\user\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
    pygrib.c(242): fatal error C1083: Cannot open include file: 'grib_api.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 status 2

事实上,pygrib 是唯一在我尝试 pipeasy_install 时不起作用的软件包 - 它适用于我尝试安装的任何软件包。这是怎么回事,我该如何解决这个问题?

pygrib 包括一个或多个 Python 用 C 编写的扩展模块,需要作为安装的一部分进行编译,并且此 C 代码依赖于某个提供名为“的头文件的库grib_api.h”。查找并安装该 C 库,然后 pygrib 安装应该可以进行。

pygriblibgrib-api 的 Python 包装器。要编译 pygrib,您需要编译 libgrib-abi 并安装库和头文件。从 https://software.ecmwf.int/wiki/display/GRIB/Releases.

下载资源