简体   繁体   中英

Installing GDAL python binding Linux

I've been trying to install the python GDAL binding from source with ./configure --with-python but when i attemp

from osgeo import gdal

I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
 File "osgeo/__init__.py", line 21, in <module>
   _gdal = swig_import_helper()
  File "osgeo/__init__.py", line 17, in swig_import_helper
    _mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: libgdal.so.1: cannot open shared object file: No such file or directory

It seems to me to be an error with swig.

If you have GDAL installed and libgdal.so exists, it looks like the python module is just not finding the library. You can try setting the LD_LIBRARY_PATH environment variable to point to the directory containing libgdal.so (eg /usr/local/lib ). If that works, run ldconfig to update your library settings so you won't have to set LD_LIBRARY_PATH every time (which many consider a bad idea ).

You Can try

sudo apt-get install odbcinst1debian2 libgdal1h

and then try importing

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