Setting LD_LIBRARY_PATH from inside Python

Your script can check for the existence/properness of the environment variable before you import your module, then set it in os.environ if it is missing, and then call os.execv() to restart the python interpreter using the same command line arguments but an updated set of environment variables. This is only advisable before any other imports … Read more