1

我已按照http://hdfeos.org/software/pyhdf.php中的说明详细说明了如何安装 pyhdf,随后尝试运行此站点上列出的示例代码(可在此处找到)。不幸的是,当我运行示例代码(我保存为 hdf.py)时,我收到以下错误消息:

$python hdf.py
Traceback (most recent call last):
  File "hdf.py", line 28, in <module>
    from pyhdf.SD import SD, SDC
  File "/Users/kyleniezgoda/anaconda/lib/python2.7/site-packages/pyhdf-0.9.0-py2.7-macosx-10.5-x86_64.egg/pyhdf/SD.py", line 1004, in <module>
    from . import hdfext as _C
  File "/Users/kyleniezgoda/anaconda/lib/python2.7/site-packages/pyhdf-0.9.0-py2.7-macosx-10.5-x86_64.egg/pyhdf/hdfext.py", line 28, in <module>
    _hdfext = swig_import_helper()
  File "/Users/kyleniezgoda/anaconda/lib/python2.7/site-packages/pyhdf-0.9.0-py2.7-macosx-10.5-x86_64.egg/pyhdf/hdfext.py", line 24, in swig_import_helper
  _mod = imp.load_module('_hdfext', fp, pathname, description)
ImportError: dlopen(/Users/kyleniezgoda/anaconda/lib/python2.7/site-packages/pyhdf-0.9.0-py2.7-macosx-10.5-x86_64.egg/pyhdf/_hdfext.so, 2): Library not loaded: libjpeg.8.dylib
  Referenced from: /Users/kyleniezgoda/anaconda/lib/python2.7/site-packages/pyhdf-0.9.0-py2.7-macosx-10.5-x86_64.egg/pyhdf/_hdfext.so
  Reason: image not found

有人看到类似的东西或有什么建议吗?如果有帮助,我正在 Mac OS 10.10.3 Yosemite 上运行。

4

2 回答 2

0

我通过升级 numpy 版本解决了同样的问题。您可以在 Anaconda Prompt 中键入以下单词:

pip install numpy --upgrade

然后再次导入。

于 2017-12-21T05:43:07.250 回答
0

在 Anaconda 提示符下使用此命令安装 jpeg:

conda install -c conda-forge jpeg
于 2019-01-06T15:47:00.167 回答