~ python3                                   

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

>>> import csv
>>> import cx_Oracle

Traceback (most recent call last):
File “<stdin>”, line 1, in <module>

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/cx_Oracle.so, 2): Library not loaded: @rpath/libclntsh.dylib.12.1
 Referenced from: /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/cx_Oracle.so

  Reason: image not found

To FIX:

$ install_name_tool -add_rpath /directory/name/containing/oracle/client application_file_name

install_name_tool -add_rpath /Library/Oracle/instantclient_12_1 /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/cx_Oracle.so

>> import cx_Oracle

–No error

Advertisements