python 链接数据库错误

用python3链接oracle产生错误:

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

主要是 instantclient版本为32位,需更换成64位。

解决方案:

一、已安装oracle客户端

1. 重新下载 instantclient 64位, 下载链接:http://jvniu.jb51.net:81/201708/tools/instantclientx64_jb51.rar

      下载完成后,解压得到 文件夹

2   将整个文件夹移动到oracle安装目录,client子文件夹内

 

3.  添加环境变量(下图为win10系统)

 

4.   重启python, 成功连接oracle。

二、未安装oracle客户端(需要连接服务器数据库的情况)

1、创建文件路径:

D:Oracle11gproduct11.2.0

2、下载 instantclient 64位  放置到 1 创建的路径下

3、将文件中后缀为 dll 的文件复制到 anaconda 安装位置

 

3. 、添加环境变量(见第一种情况)

4、重启python


参考:https://blog.csdn.net/guimaxingmc/article/details/80360840

原文地址:https://www.cnblogs.com/51python/p/10526003.html