Skip to content

Instantly share code, notes, and snippets.

@devender-yadav
Last active November 15, 2019 10:52
Show Gist options
  • Save devender-yadav/f29fe683ea478b557bb59b96049065fc to your computer and use it in GitHub Desktop.
Save devender-yadav/f29fe683ea478b557bb59b96049065fc to your computer and use it in GitHub Desktop.
Install cx_Oracle 5.3 python package on Mac

Download instantclient from Oracle website

Go to - https://www.oracle.com/technetwork/topics/intel-macsoft-096467.html

Download instantclient-basic and instantclient-sdk appropriate version.

For Example,

  • instantclient-basic-macos.x64-12.1.0.2.0.zip
  • instantclient-sdk-macos.x64-12.1.0.2.0.zip

Note : You need to Accept License Agreement to download these files.

Unzip instantclient

(Assuming downloaded files are in ~/Downloads directory)

mkdir ~/oracle
cd ~/oracle
unzip ~/Downloads/instantclient-basic-macos.x64-12.1.0.2.0.zip

#copy sdk folder in ~/oracle/instantclient_12_1 directory
cd ~/Downloads
unzip ~/Downloads/instantclient-sdk-macos.x64-12.1.0.2.0.zip 
mv ~/Downloads/instantclient_12_1/* ~/oracle/instantclient_12_1

Export ORACLE_HOME and add to PATH

vi ~/.bash_profile

Add this line

export ORACLE_HOME=~/oracle/instantclient_12_1
export PATH=$ORACLE_HOME:$PATH

Add links

cd $ORACLE_HOME 
ln -s libclntsh.dylib.12.1 libclntsh.dylib

Type ls -ltr to ensure that link is added.

Installation

pip install cx_Oracle==5.3

Troubleshooting

Error : distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation

Solution: Export ORACLE_HOME

Error: distutils.errors.DistutilsSetupError: cannot locate Oracle include files

Solution: Add link lib

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