【发布时间】:2017-07-26 16:11:24
【问题描述】:
我正在拼命想让 GDAL 在我的 Python 3.4 Conda 环境中工作,但我遇到了一个错误。我曾尝试使用 Python 2.7、3.3、3.4 和 3.6 安装 GDAL 以进行测试,而 GDAL 仅适用于 2.7 和 3.6。 我在 Debian 8.8 Jessie 上运行并升级了我的 Conda。
以下是我遵循的步骤:
$ conda create -n py34 python=3.4
$ conda install -n py34 gdal -c conda-forge
为了测试,我会这样做:
$ source activate py34
$ python -c 'import gdal'
为 Python 2.7 和 3.6 完成后,它可以正常工作。但是,由于与其他库的兼容性,我需要在 3.4 环境中运行 GDAL。
对于 Python 3.3(以防万一有用)我得到:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/username/anaconda3/envs/py33/lib/python3.3/site-packages/gdal.py", line 2, in <module>
from osgeo.gdal import deprecation_warn
File "/home/username/anaconda3/envs/py33/lib/python3.3/site-packages/osgeo/__init__.py", line 21, in <module>
_gdal = swig_import_helper()
File "/home/username/anaconda3/envs/py33/lib/python3.3/site-packages/osgeo/__init__.py", line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
File "/home/username/anaconda3/envs/py33/lib/python3.3/imp.py", line 188, in load_module
return load_dynamic(name, filename, file)
ImportError: libcom_err.so.3: cannot open shared object file: No such file or directory
对于 Python 3.4 也是如此:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/username/anaconda3/envs/py34/lib/python3.4/site-packages/gdal.py", line 2, in <module>
from osgeo.gdal import deprecation_warn
File "/home/username/anaconda3/envs/py34/lib/python3.4/site-packages/osgeo/__init__.py", line 21, in <module>
_gdal = swig_import_helper()
File "/home/username/anaconda3/envs/py34/lib/python3.4/site-packages/osgeo/__init__.py", line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
File "/home/username/anaconda3/envs/py34/lib/python3.4/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
ImportError: libicui18n.so.56: cannot open shared object file: No such file or directory
【问题讨论】:
-
你能试试
conda install -n py34 gdal icu=56.* -c conda-forge吗? -
以下对我有用(我的频道中已经有
conda-forge):conda create -n gdal python=3.4 gdal icu=56.* -
不幸的是,我收到与您建议的命令相同的错误!
标签: python python-2.7 python-3.x conda gdal