Reputation: 1241
I have successfully installed cx_oracle using pip, but when error
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/cx_Oracle.so, 2): Library not loaded: libclntsh.dylib.11.1
Referenced from: /usr/local/lib/python2.7/site-packages/cx_Oracle.so
Reason: unsafe use of relative rpath libclntsh.dylib.11.1 in /usr/local/lib/python2.7/site-packages/cx_Oracle.so with restricted binary
occurred when I import cx_Oracle
with ipython console. What's more another error
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/cx_Oracle.so, 2): Library not loaded: libclntsh.dylib.11.1
Referenced from: /usr/local/lib/python2.7/site-packages/cx_Oracle.so
Reason: image not found
occurred when I using default python console.
It did not work in pycharm ide, either, I've spent much time working on this, anyone knows how to solve it? THX
Upvotes: 1
Views: 849
Reputation: 925
Do you have the Oracle Instant Client and SDK installed?
If so, you have to export the library paths appropriately, depending on where you put your client. For example:
PATH=$PATH:/Library/Oracle/instantclient_11_2
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Library/Oracle/instantclient_11_2
CLASSPATH=$CLASSPATH:$ORACLE_HOME
TNS_ADMIN=/Library/Oracle/instantclient_11_2/network/admin
export TNS_ADMIN
export PATH
export DYLD_LIBRARY_PATH
export CLASSPATH
Upvotes: 1