title: cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "dlopen(libclntsh.dylib, 1): image not found"
body: <p>I am trying to set up <code>cx_Oracle</code> to work with Python.</p>
  
  <p>I am using</p>
  
  <ul>
  <li>Python 2.7.10, 64-bit</li>
  <li><code>cx_Oracle</code> version 6.0.2</li>
  <li>MacOS Sierra 10.12.6</li>
  </ul>
  
  <p>I set the following environment variables:</p>
  
  <pre class="lang-shell prettyprint-override"><code>export ORACLE_HOME="/Volumes/DATA/Programs/PY/instantclient_12_1"
  export DYLD_LIBRARY_PATH="$ORACLE_HOME:$DYLD_LIBRARY_PATH"
  export LD_LIBRARY_PATH=$ORACLE_HOME
  export PATH=$PATH:$ORACLE_HOME
  export ORACLE_SID=edocd
  export TNS_ADMIN=/Volumes/DATA/Programs/PY/instantclient_12_1/network/admin
  export TWO_TASK=${ORACLE_SID}
  </code></pre>
  
  <p>Here is what I tried:</p>
  
  <ol>
  <li>Installed as Administrator </li>
  <li><code>sudo python setup.py build</code></li>
  <li><code>sudo python setup.py install</code></li>
  </ol>
  
  <p>When I tried to execute a simple script to check the Oracle connection I was able to connect successfully via <code>sqlplus</code>.</p>
  
  <p>Here is the error I receive:</p>
  
  <blockquote>
    <p>cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "dlopen(libclntsh.dylib, 1): image not found". See <a href="https://oracle.github.io/odpi/doc/installation.html#macos" rel="noreferrer">https://oracle.github.io/odpi/doc/installation.html#macos</a> for help</p>
  </blockquote>