简体   繁体   中英

Windows, PyCharm: DPI-1047: Cannot locate a 32-bit Oracle Client library

I need help, I'm getting this error all the time. ''' Traceback (most recent call last): File "C:/Users/DELL/PycharmProjects/Anonimizacija/OracleConnect.py", line 3, in con = cx_Oracle.connect("andjela", "andjela", "localhost/xe") cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 32-bit Oracle Client library: "C:\\app\\DELL\\product\\18.0.0\\dbhomeXE\\bin\\oci.dll is not the correct architecture". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help ''' I don't know how to fix it.

You have a 32-bit python but a 64-bit Oracle database.

The best thing would be install a 64-bit Python.

Or you could upgrade to cx_Oracle to 8, download a 32-bit Oracle Instant Client and unzip it, and then pass the Instant Client directory to cx_Oracle 8's init_oracle_client() :

import cx_Oracle
import sys

try:
    cx_Oracle.init_oracle_client(lib_dir=r"C:\oracle\instantclient_19_6")
except Exception as err:
    print("Whoops!")
    print(err);
    sys.exit(1);

See the cx_Oracle doc Using cx_Oracle.init_oracle_client() to set the Oracle Client directory .

With this function you do not need to add the Instant Client directory to PATH (which might impact Oracle XE database use).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM