[英]Why conda cannot create environment with python=3.4 installed in it
[英]Cannot use GDAL with Python 3.3 or 3.4 in Conda
我拼命試圖讓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
解決方案從問題移到答案:
編輯:問題解決了!
解決方案在以下線程中: imoporting GDAL時出現問題:ImportError,未加載庫,未找到圖像
將conda-forge添加到我的.condarc之后,我做了:
$ conda create -n TEST_GDAL python=3.4 gdal $ conda install -n TEST_GDAL -f jpeg=8 $ conda install -n TEST_GDAL libgdal
降級了某些軟件包並安裝了GDAL 2.2.1
希望降級不會干擾其他軟件包!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.