无法将 gdal 导入与 anaconda (MacOSX) 一起安装的 python
Unable import gdal into python installed with anaconda (MacOSX)
当我尝试在 Mac 上导入 osgeo gdal 时得到以下信息。我已经通过 anaconda 安装了 gdal 等。
>>> from osgeo import gdal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ste/anaconda/lib/python2.7/site-packages/osgeo/__init__.py", line 21, in <module>
_gdal = swig_import_helper()
File "/Users/ste/anaconda/lib/python2.7/site-packages/osgeo/__init__.py", line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: dlopen(/Users/ste/anaconda/lib/python2.7/site- packages/osgeo/_gdal.so, 2): Library not loaded: @loader_path/./libgssapi_krb5.2.2.dylib
Referenced from: /Users/ste/anaconda/lib/libgdal.20.dylib
Reason: image not found
看起来 krb5 是一个依赖项,但不是由 anaconda 自动安装的:
conda install krb5
这解决了我的问题!
当我尝试在 Mac 上导入 osgeo gdal 时得到以下信息。我已经通过 anaconda 安装了 gdal 等。
>>> from osgeo import gdal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ste/anaconda/lib/python2.7/site-packages/osgeo/__init__.py", line 21, in <module>
_gdal = swig_import_helper()
File "/Users/ste/anaconda/lib/python2.7/site-packages/osgeo/__init__.py", line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: dlopen(/Users/ste/anaconda/lib/python2.7/site- packages/osgeo/_gdal.so, 2): Library not loaded: @loader_path/./libgssapi_krb5.2.2.dylib
Referenced from: /Users/ste/anaconda/lib/libgdal.20.dylib
Reason: image not found
看起来 krb5 是一个依赖项,但不是由 anaconda 自动安装的:
conda install krb5
这解决了我的问题!