Reputation: 4017
I have installed gdal version 1.11.2, however I have problems with undefined symbols. A proposed solution for this is given by gerrit:
export LD_PRELOAD=/usr/local/lib/libgdal.so.1
However, this only works if I call the python script from the command line. If I call the script from a subprocess.Popen
, this will obviously not work.
Is there a way to define the LD_PRELOAD
permanently?
Upvotes: 1
Views: 454
Reputation: 148965
The best solution IMHO is to fix the problem at OS level. If you want gdal
to be accessible to only some users of your platform, each user should add the line
export LD_PRELOAD=/usr/local/lib/libgdal.so.1
in his own .profile
file (assuming they all use bash or a compatible shell)
Alternatively, if all users should be able to use gdal
, that line should be added to the system /etc/profile
file.
Upvotes: 1
Reputation: 2224
you can save the export in your /etc/environment if you want to have it globally for every user
or you can use the env argument like so:
subprocess.Popen(command, env={'LD_PRELOAD': '/usr/local/lib/libgdal.so.1'})
see also here: Python subprocess/Popen with a modified environment
Upvotes: 1