Python cx_Oracle连接报错 :oci.dll is not the correct architecture

之前cx_Oracle连接没有问题,突然有一天就报了DPI-1047: 64-bit Oracle Client library cannot be loaded: “D:\OraHome92\bin\oci.dll is not the correct architecture”,然后就开始上网百度了资料,基本的解决思路都是使用的oci.dll版本为32位,要换成64位。

Python cx_Oracle连接报错 :oci.dll is not the correct architecture
顺着以上思路,我下载了instantclient 64位(百度搜索,可以下载得到),然后添加环境变量,如图所示,这里记得,位置要在OraHome/bin上方,不然会先调用OraHome/bin/里的oci.dll 文件。

结论:版本需统一,cx_Oracle版本为64位,使用的oci.dll版本也要为64位。