我的Mac上有anaconda3发行版。我做了
conda install -c conda-forge pyhdf
当我在python中执行以下操作
import pyhdf
它工作正常,但是
from pyhdf.SD import SD
给我这个我无法解决的错误
atmos-vllgsbr2:Code vllgsbr2$ python test.py
Traceback (most recent call last):
File "test.py", line 2, in <module>
from pyhdf.SD import SD
File "/Users/vllgsbr2/anaconda3/lib/python3.6/site-packages/pyhdf/SD.py", line 1004, in <module>
from . import hdfext as _C
File "/Users/vllgsbr2/anaconda3/lib/python3.6/site- packages/pyhdf/hdfext.py", line 28, in <module>
_hdfext = swig_import_helper()
File "/Users/vllgsbr2/anaconda3/lib/python3.6/site- packages/pyhdf/hdfext.py", line 24, in swig_import_helper
_. mod = imp.load_module('_hdfext', fp, pathname, description)
File "/Users/vllgsbr2/anaconda3/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/Users/vllgsbr2/anaconda3/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: dlopen(/Users/vllgsbr2/anaconda3/lib/python3.6/site- packages/pyhdf/_hdfext.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libjpeg.9.dylib
Referenced from: /Users/vllgsbr2/anaconda3/lib/python3.6/site- packages/pyhdf/_hdfext.cpython-36m-darwin.so
Reason: Incompatible library version: _hdfext.cpython-36m-darwin.so requires version 13.0.0 or later, but libjpeg.9.dylib provides version 12.0.0
我也做了这些解决方案
https://github.com/fhs/python-hdf4/issues/6 和 https://hdfeos.org/software/pyhdf.php
这两个链接暂时组合在一起,但随后失败了,并且不断出现相同的问题