Skip to content

Instantly share code, notes, and snippets.

@natros
Created October 8, 2015 15:54
Show Gist options
  • Save natros/3b7192dce13bc4a9b97b to your computer and use it in GitHub Desktop.
Save natros/3b7192dce13bc4a9b97b to your computer and use it in GitHub Desktop.
python cx_Oracle (cx-Oracle) OSX 10.11 El Capitan
cd ~/Library/Python/2.7/lib/
mkdir oracle
cd oracle
export ORACLE_HOME=$PWD
unzip ~/Downloads/instantclient-basic-macos.x64-11.2.0.4.0.zip
unzip ~/Downloads/instantclient-sdk-macos.x64-11.2.0.4.0.zip
mv instantclient_11_2/* .
rmdir instantclient_11_2
ln -s libclntsh.dylib.11.1 libclntsh.dylib
ln -s libocci.dylib.11.1 libocci.dylib
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME
pip install --user cx_Oracle
install_name_tool -change /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1 ${HOME}/Library/Python/2.7/lib/oracle/libclntsh.dylib.11.1 ${HOME}/Library/Python/2.7/lib/python/site-packages/cx_Oracle.so
chmod 755 ${HOME}/Library/Python/2.7/lib/oracle/libclntsh.dylib.11.1
install_name_tool -change /ade/dosulliv_ldapmac/oracle/ldap/lib/libnnz11.dylib ${HOME}/Library/Python/2.7/lib/oracle/libnnz11.dylib ${HOME}/Library/Python/2.7/lib/oracle/libclntsh.dylib.11.1
install_name_tool -change /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1 ${HOME}/Library/Python/2.7/lib/oracle/libclntsh.dylib.11.1 libociei.dylib
chmod 755 libocijdbc11.dylib
install_name_tool -change /ade/b/2475221476/oracle/ldap/lib/libnnz11.dylib ${HOME}/Library/Python/2.7/lib/oracle/libnnz11.dylib libocijdbc11.dylib
install_name_tool -change /ade/b/2475221476/oracle/rdbms/lib/libclntsh.dylib.11.1 ${HOME}/Library/Python/2.7/lib/oracle/libclntsh.dylib.11.1 libocijdbc11.dylib
install_name_tool -change /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1 ${HOME}/Library/Python/2.7/lib/oracle/libclntsh.dylib.11.1 uidrvci
install_name_tool -change /ade/dosulliv_ldapmac/oracle/ldap/lib/libnnz11.dylib ${HOME}/Library/Python/2.7/lib/oracle/libnnz11.dylib uidrvci
install_name_tool -change /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1 ${HOME}/Library/Python/2.7/lib/oracle/libclntsh.dylib.11.1 adrci
install_name_tool -change /ade/dosulliv_ldapmac/oracle/ldap/lib/libnnz11.dylib ${HOME}/Library/Python/2.7/lib/oracle/libnnz11.dylib adrci
install_name_tool -change /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1 ${HOME}/Library/Python/2.7/lib/oracle/libclntsh.dylib.11.1 genezi
chmod 755 libocci.dylib
install_name_tool -id libocci.dylib libocci.dylib
chmod 755 libnnz11.dylib
install_name_tool -id libnnz11.dylib libnnz11.dylib
install_name_tool -id libclntsh.dylib.11.1 libclntsh.dylib.11.1
@gregpinero
Copy link

How did you figure this out?? How would I modify this to install to a virtual env?

@gregpinero
Copy link

I tried changing the directory to here and running it /Users/gpinero/sx_direct_env/lib/python2.7 to it would use my virtual env.

It's odd, I'm seeing this:

    import cx_Oracle
ImportError: dlopen(/Users/gpinero/sx_direct_env/lib/python2.7/site-packages/cx_Oracle.so, 2): Library not loaded: /b/227/rdbms/lib/libclntsh.dylib.10.1
  Referenced from: /Users/gpinero/sx_direct_env/lib/python2.7/site-packages/cx_Oracle.so
  Reason: image not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment