简体   繁体   中英

ImportError installing GDAL on Ubuntu 14.04 with Anaconda Python 3.5

I installed the GDAL library on Ubuntu 14.04 through the Anaconda (Python 3.5) distribution. After installation, which seems to work fine, I try importing it and I get this error:

>>>from osgeo import gdal

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/klab/anaconda3/lib/python3.5/site-packages/osgeo/__init__.py", line 21, in <module>
_gdal = swig_import_helper()
  File "/home/klab/anaconda3/lib/python3.5/site-packages/osgeo/__init__.py", line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
  File "/home/klab/anaconda3/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
  File "/home/klab/anaconda3/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)

ImportError: libcom_err.so.3: cannot open shared object file: No such file or directory

I tried installing through PIP and Conda install commands with the same error. I did go to the directory where this should exist, and it indeed is missing. I figured that if this were a true dependency, it would have installed automatically. Has anybody else had this problem?

I was trying to follow this link, but it wasn't helpful. https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/2-bXTbSiQzg

I was able to figure it out. I used the following command to find the location of the shared library.

locate libcom_err

It was of course the wrong one. It was libcom_err.so.2. I used a symbolic link in the same directory to point to the right library.

ln -s libcom_err.so.2 libcom_err.so.3

Worked perfectly!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM