I have some custom modules that are generated using SWIG that are installed in a a local path eg:
When I try to run a python script that uses one of these modules, I get an import error:
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) ImportError: No module named _mag_manip
I've figured out that this is due to the shebang at the top of the python script:
Because /usr/bin/env is protected by System Integrity Protection (SIP), the DYLD_LIBRARY_PATH environment variable is not loaded and some modules cannot be found. A fix is to replace the shebang with the hardcoded path of python ie:
Since my code runs on Linux and Mac OSX, replacing the normal python shebang with a hardcoded path on mac is not a really good solution. Does anybody know what the best solution is here?