Installing Linux related GDAL python

I am trying to set 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 that the error is with swig.

+4
source share
2 answers

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

+2
source

You can try

 sudo apt-get install odbcinst1debian2 libgdal1h 

and then try to import

+1
source

Source: https://habr.com/ru/post/1490273/


All Articles