Download the following files from Oracle
- instantclient-basic-
$VERSION
-macosx-x64.zip - instantclient-sdk-
$VERSION
-macosx-x64.zip
Edit ~/.zshrc
or ~/.bashrc
, add following:
export ORACLE_HOME=/usr/local/share/oracle/instantclient_12_1
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME
export VERSION=12.1.0.2.0
export ARCH=x86_64
And then.
# actiavte ~/.zshrc
source ~/.zshrc
# Create a directory
mkdir -p /usr/local/share/oracle
# Unpack both files to that directory
tar -xzf instantclient-basic-$VERSION-macosx-x64.zip
tar -xzf instantclient-sdk-$VERSION-macosx-x64.zip
# all files will now be located in /usr/local/share/oracle/instantclient_12_1.
# create sym links
ln -s libclntsh.dylib.11.1 libclntsh.dylib
ln -s libocci.dylib.11.1 libocci.dylib
env ARCHFLAGS="-arch $ARCH" pip install cx_Oracle
Problem
solution
First, check your Mac's hostname.
Then, add
127.0.0.1 <hostname>
line to/etc/hosts
.For example, mine is:
After
/etc/hosts
is saved, the problem is solved.