linux的python安装gdal_安装GDAL python绑定Linux

我一直在尝试使用./configure –with-python从源代码安装python GDAL绑定,但是当我尝试时

from osgeo import gdal

我明白了:

Traceback (most recent call last):

File "", line 1, in

File "osgeo/__init__.py", line 21, in

_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

在我看来,这是一个错误的swig.

解决方法:

如果你安装了GDAL并且libgdal.so存在,那看起来python模块就是找不到库.您可以尝试将LD_LIBRARY_PATH环境变量设置为指向包含libgdal.so的目录(例如/usr/local/lib).如果可行,请运行ldconfig以更新库设置,这样您就不必每次都设置LD_LIBRARY_PATH(许多人认为是bad idea).

标签:python,linux,gdal

来源: https://codeday.me/bug/20190625/1283489.html

你可能感兴趣的:(linux的python安装gdal_安装GDAL python绑定Linux)