Mac OS 下python3 cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 1): image not found"

今天在用python3连接oracle数据库的时候报错,详细信息:

cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 1): image not found".........

后来,嗯参照了网上各种办法。。。

最后如下

1.官网下载合适的instantclient,我自己本地数据库连接工具用的是12_2,所以直接就省略下载这一步。

(下载地址:https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html)

2.用户下创建lib文件:mkdir lib

我在这儿创建的

3.建立软连接到lib文件下;

ln -s /xxxx/instantclient_12_2/libclntsh.dylib ~/lib/

没事儿,创建错了,就用unlink 删掉

最后,终于成功了

原文地址:https://www.cnblogs.com/xiaoxiaorichang/p/14550672.html