简体   繁体   中英

cx_Oracle doesn't work in executable but works in IDE

I am using Python 3.8.5 (Anaconda) and am trying to connect to a Database with oracle instant client library 19_9 and have cx_Oracle 8.1 This command:

cx_Oracle.init_oracle_client(lib_dir=path )
con = cx_Oracle.connect(db_connection_string)

gives the following error:

cx_Oracle.DatabaseError: DPI-1072 Oracle client library version is unsupported 

The confusing thing is that this doesn't occur at all in the IDE but only in the executable. I am using auto-py-to-exe to create the exe from the anaconda prompt.

Thank you for your help.

UPDATE:

I get: (where PATH is my client library path)

load in dir PATH
load with name PATH\oci.dll
load by OS successful
validating loaded library
DPI-1072 Oracle client library version is unsupported

Then it tries again:

check module directory
module name is ...
load in dir PATH
load with name PATH\oci.dll
load by OS failure:The specified module could not be found
load with OS search heuristic
load with name oci.dll
load by OS failure: The specified module could not be found
Traceback ...

I am using Windows 10 Pro, version 20H2, OS build 19042.804 (I don't know if this is useful)

Set the environment variable DPI_DEBUG_LEVEL to the value 64 and look at what cx_Oracle is attempting to load in both cases. That error will take place if the Oracle client library is too old (10g or earlier) or if the library can be loaded but not executed for some reason. This happens, for example, with Windows 7 and 19c client libraries.

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