我在Webfaction上安装了GDAL,使用以下命令:
$ mkdir src
$ cd scr
$ svn checkout https://svn.osgeo.org/gdal/branches/1.10/gdal gdal
$ cd gdal
$ ./configure --with-python=/usr/local/bin/python2.7
$ make
$ make install
现在,如果我尝试导入GDAL,则会收到以下错误:
>>> from osgeo import gdal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ustroetz/lib/python2.7/GDAL-1.10.1-py2.7-linux-x86_64.egg/osgeo/__init__.py", line 21, in <module>
_gdal = swig_import_helper()
File "/home/ustroetz/lib/python2.7/GDAL-1.10.1-py2.7-linux-x86_64.egg/osgeo/__init__.py", line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: /home/ustroetz/lib/python2.7/GDAL-1.10.1-py2.7-linux-x86_64.egg/osgeo/_gdal.so: undefined symbol: GDALUseTransformer
但是,如果 cd lib
并在那里尝试它就可以了:
>>> from osgeo import gdal
>>>
我必须设置什么才能在Webfaction的任何地方使用它?
我的 lib 文件夹包含以下内容:
$ ls
gdalplugins libgdal.la libgdal.so.1 python2.4 python2.7
libgdal.a libgdal.so libgdal.so.1.17.1 python2.5
我让它与以下内容一起工作:
-
打开你的
~/.bashrc
。您可以通过在命令行中键入来执行此操作:$ vi ~/.bashrc
-
添加到
~/.bashrc
以下内容:export LD_LIBRARY_PATH=/home/your username/lib
-
关闭并保存使用
:x
-
重新启动终端。