I have an executable that uses some dynamic libraries, and it runs successfully from an OSX terminal when 'DYLD_LIBRARY_PATH' is correctly set:
airbook:layoutSpaceTest daniel$ echo $DYLD_LIBRARY_PATH
/Developer/NVIDIA/CUDA-7.5/lib:/Developer/OptiX/lib64
airbook:layoutSpaceTest daniel$ heliosim -f degraded.sunshapein
'HelioSim' Port: 1200 with 1 threads
'HelioSim' ENDED
However I cannot run the executable in python as it doesn't pick up 'DYLD_LIBRARY_PATH' or 'LD_LIBRARY_PATH':
airbook:layoutSpaceTest daniel$ python
Python 2.7.10 (default, Aug 22 2015, 20:33:39)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os,sys
>>> os.environ["DYLD_LIBRARY_PATH"]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 23, in __getitem__
raise KeyError(key)
KeyError: 'DYLD_LIBRARY_PATH'
I have read that /usr/bin/env python strips DYLD_LIBRARY_PATH and LD_LIBRARY_PATH from the imported environment. Is there a way to prevent this?
Any help would be greatly appreciated!
(python 2.7, OSX el capitan)