简体   繁体   中英

GDAL Python on Webfaction

I have GDAL installed on Webfaction wight the following commands:

$ 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

Now if I try to import GDAL I get the following error:

>>> 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

However if cd to lib and try it there it works just fine:

>>> from osgeo import gdal
>>> 

What do I have to set in order to use it from anywhere within Webfaction?

My lib folder contains the following:

$ ls
gdalplugins  libgdal.la  libgdal.so.1       python2.4  python2.7
libgdal.a    libgdal.so  libgdal.so.1.17.1  python2.5

I got it to work with the following:

  1. Open your ~/.bashrc . You do this by typing in the command line:

    $ vi ~/.bashrc

  2. Add to ~/.bashrc the following:

    export LD_LIBRARY_PATH=/home/your username/lib

  3. Close and save with

    :x

  4. Restart the terminal.

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