Jeg forsøgte ovenstående og fik følgende fejl, da jeg forsøgte at installere cx_Oracle ved hjælp af Oracle instantclient 12.1 :
[535]: /opt/instantclient_12_1 $ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/cx_Oracle.so, 2):
Library not loaded: @rpath/libclntsh.dylib.12.1
Referenced from: /Library/Python/2.7/site-packages/cx_Oracle.so
Reason: image not found
Læg mærke til @rpath i fejlen - det viser sig, at når man bygger cx_Oracle-biblioteket (for instantclient 12.1) på El Capitan forventer gcc-kompileren, at -rpath-flaget er indstillet til at vide, hvor man kan finde de førnævnte dynamisk forbundne biblioteker (*.dylib). Som standard, på instantclient 12.1, pip gør ikke dette for dig.
# Set -rpath option before installing...this will use $ORACLE_HOME during compilation
export FORCE_RPATH=TRUE
pip install cx_Oracle
# And verify cx_Oracle was correctly installed
python -c "import cx_Oracle"
# If this line fails install cx_Oracle with:
# pip install --no-cache-dir --allow-external --allow-unverified cx_oracle
python -c "import cx_Oracle"
bør ikke rapportere fejl.
Se mit indlæg på for at få en komplet installationsvejledning (inklusive download og konfiguration af øjeblikkelig klient) http://thelaziestprogrammer.com/sharrington/databases/oracle/install-cx_oracle-mac for detaljer.