DPI-1047:Cannot locate a 64-bit Oracle Client library:The specified module could not be found

Solve python cx_Oracle module DPI-1047: Cannot locate a 64-bit Oracle Client library:

An error is reported when connecting to the server Oracle database through the cx_Oracle module of python.
insert image description here

Solution

Specify the directory containing the Oracle Instant Client library:
Client environment:
win10 64-bit
python version:
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit ( AMD64)] on win32
cx_Oracle version:
8.1.0
Oracle client version:
unknown, bundled and installed with other secondary development software packages, can be used normally

# encoding:utf-8
import cx_Oracle
"""指定包含Oracle Instant Client库的目录"""
cx_Oracle.init_oracle_client(lib_dir="C:\\instantclient_19_10")

resolution process

Baidu found some solutions, including:
1. Reinstall the Oracle database (64-bit)
2. Reinstall the Oracle client (64-bit)
3. Reinstall python (64-bit)
4. Set system environment variables, etc.

I feel that reinstalling is too troublesome. I found the cx_Oracle document on the Oracle official website:
described above
cx_Oracle initializes
the Oracle64-bit client download address

result

Download the Oracle client and decompress it to the corresponding path. Before creating a database connection, specify the OracleClient directory to
run the existing program normally without affecting the original client environment.
insert image description here

Guess you like

Origin blog.csdn.net/bill_love_c/article/details/114668974