经常会遇见自己写的python打包的exe放到其他电脑或者服务器上时执行时提示
Error: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows for help
”
问题其实很明显,提示版本不一致。那程序已经打包成exe执行文件了,作为使用中肯定是需要提供依赖的环境执行提供的工具。
原因
Windows环境下,如果安装的是64位Python,在使用cx_Oracle时,默认调用的是64位Oracle客户端,这时我们也只能安装cx_Oracle的-win_amd64位版。
解决方案一:
1、安装oracle 64客户端
2、将客户端目录配置到path环境变量product\11.2.0\client_1\bin
解决方案二:
1、下载轻量级的Oracle客户端(选择自己数据库服务端的版本对于的客户端):
比如 instantclient-basic-windows.x64-11.2.0.4.0.zip
安装包下载地址:https://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html
2、配置环境变量path:
将客户端的目录,比如 D:\oracle\instantclient_11_2 添加到 path