Skip to content
Advertisement

Permanently define environment variable (for Python gdal undefined symbol)

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?

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement