This is related to the system integrity protection (SIP) changes in El Capitan, which among other things prevents DYLD_LIBRARY_PATH being inherited by spawned processes.
You can modify the cx_Oracle.so
library to use the actual path to the Oracle client library instead of the searched path that no longer works; make sure you have ORACLE_HOME
still set to point to your actual instant client location, and also note that the exact path reported by ImportError
should be used - the 3071542110
value may vary depending on the version/build of Instant Client you have installed:
export ORACLE_HOME=/usr/local/lib/share/oracle/installclient_11_2
install_name_tool -change
/ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
$ORACLE_HOME/libclntsh.dylib.11.1
/Library/Python/2.7/site-packages/cx_Oracle.so
... but then that library can't find another Oracle one:
ImportError: dlopen(/Library/Python/2.7/site-packages/cx_Oracle.so, 2): Library not loaded: /ade/b/3071542110/oracle/ldap/lib/libnnz11.dylib
Referenced from: /usr/local/lib/share/oracle/installclient_11_2/libclntsh.dylib.11.1
Reason: image not found
So you'd need to change that library too, which you may be less comfortable with:
install_name_tool -change
/ade/b/3071542110/oracle/ldap/lib/libnnz11.dylib
$ORACLE_HOME/libnnz11.dylib
$ORACLE_HOME/libclntsh.dylib.11.1
Depending on the exact client version/build you may need to make the file writable before running that command, with:
chmod 755 $ORACLE_HOME/libclntsh.dylib.11.1
With those changes I can run the cx_Oracle
tests on El Capitan.
More into on install_name_change
here.
It looks like the 12c instant client has been built in a way that avoids this issue, so upgrading to that is gong to be simpler than hacking around int he 11g files.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…