When trying to run a script that uses cx_Oracle
I'm getting an ImportError
.
./runtests.py <args here>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/smeatonj/Development/.virtualenvs/djangopy3/lib/python3.5/site-packages/cx_Oracle.cpython-35m-darwin.so, 2): Library not loaded: @rpath/libclntsh.dylib.12.1
Referenced from: /Users/smeatonj/Development/.virtualenvs/djangopy3/lib/python3.5/site-packages/cx_Oracle.cpython-35m-darwin.so
Reason: image not found
Advice elsewhere suggests exporting LD_LIBRARY_PATH
which I've done. When I open a python shell and try to import cx_Oracle
it works fine.
The problem was that the script was prefixed with:
I think this prevents the shell from using
LD_LIBRARY_PATH
. The fix is to execute the script with python directly:I'd be happy to edit this answer with additional information on
LD_LIBRARY_PATH
if someone knows more.