gpt4 book ai didi

python - 无法在 OS X 上安装 netCDF4 python 包

转载 作者:太空狗 更新时间:2023-10-30 01:29:28 26 4
gpt4 key购买 nike

我正在尝试使用 pip install netCDF4 在 OS X 上安装 netCDF4,但出现以下错误:

------------------------------------------------------------
/usr/local/bin/pip run on Wed Aug 7 23:02:37 2013
Downloading/unpacking netCDF4

Running setup.py egg_info for package netCDF4



HDF5_DIR environment variable not set, checking some standard locations ..

checking /Users/mc ...

checking /usr/local ...

checking /sw ...

checking /opt ...

checking /opt/local ...

checking /usr ...

Traceback (most recent call last):

File "<string>", line 16, in <module>

File "/var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4/setup.py", line 114, in <module>

raise ValueError('did not find HDF5 headers')

ValueError: did not find HDF5 headers

Complete output from command python setup.py egg_info:



HDF5_DIR environment variable not set, checking some standard locations ..

checking /Users/mc ...

checking /usr/local ...

checking /sw ...

checking /opt ...

checking /opt/local ...

checking /usr ...

Traceback (most recent call last):

File "<string>", line 16, in <module>

File "/var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4/setup.py", line 114, in <module>

raise ValueError('did not find HDF5 headers')

ValueError: did not find HDF5 headers

----------------------------------------

Command python setup.py egg_info failed with error code 1 in /var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4

Exception information:
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/basecommand.py", line 107, in main
status = self.run(options, args)
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/commands/install.py", line 256, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 1042, in prepare_files
req_to_install.run_egg_info()
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 236, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/util.py", line 612, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4

我已经将 HDF5 安装到 /usr/local/hdf5/ 但我仍然遇到同样的错误。我是 Python 的新手,因此非常感谢任何帮助。

谢谢。

最佳答案

您可能需要将 HDF5_DIR 环境变量设置为安装 HDF5 的位置;它正在寻找标准安装路径,但没有找到 HDF5 的 header - 因此至少有一个错误。

你可以在调用 pip 之前简单地设置它:

HDF5_DIR=/usr/local/hdf5 pip install netCDF4

或者导出它然后调用 pip:

export HDF5_DIR=/usr/local/hdf5
pip install netCDF4

关于python - 无法在 OS X 上安装 netCDF4 python 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18107298/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com