让GDAL在Python中工作(libjpeg.so.8:无法打开共享对象文件)

时间:2017-06-27 07:02:38

标签: linux python-2.7 anaconda gdal libjpeg

我一直试图让GDAL在Python(Anaconda)上工作很长一段时间,但我无法弄明白。如果有人可以帮助我,那会很棒。

首先我尝试从conda安装gdal。这看起来很有效。

solo@debian:/etc/opt$ conda install gdal
Fetching package metadata .........
Solving package specifications: .
# All requested packages already installed.
# packages in environment at /home/solo/anaconda2:
gdal  2.1.0 py27_0

但是当我尝试从Anaconda-Python导入gdal时,我收到了这个错误:

Python 2.7.13 |Anaconda custom (64-bit)| (default, Dec 20 2016, 23:09:15) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import gdal
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named gdal
>>> 

但我遵循标准方法将gdal安装到我的(sudo)用户默认Python(当我执行“sudo Python”时加载的那个)并且它似乎工作正常。我的sudo用户中的Python版本是:

solo@debian:/etc/opt$ sudo python
Python 2.7.9 (default, Jun 29 2016, 13:08:31) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdal
>>> 

当我从命令行运行gdalinfo时,无论有没有sudo,我也得到不同的结果:

solo@debian:/etc/opt$ sudo gdalinfo
Usage: gdalinfo [--help-general] [-mm] [-stats] [-hist] [-nogcp] [-nomd]
                [-norat] [-noct] [-nofl] [-checksum] [-proj4] [-mdd domain]*
                [-sd subdataset] datasetname

FAILURE: No datasource specified.
solo@debian:/etc/opt$ gdalinfo
gdalinfo: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory

如何在没有sudo的情况下使用Python工作gdal?我尝试了几个Stackoverflow解决方案来修复libjpeg.so.8,但还没有设法解决这个问题。

0 个答案:

没有答案