linux环境下使用python连接Oracle需要使用cx-Oracle和instantclient。
一、安装cx_Oracle
外网环境直接
pip install cx_Oracle
内网环境
去官网上下载wheel文件,导入内网环境后install
import cx_Oracle
conn = cx_Oracle.connect(rkcx_zhanghao/rkcx_mima@10.64.54.93:31521/rkqry)
直接运行会报错
cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: " libclntsh.so: cannot open shared object file: No such file or directory".
是因为环境变量配置不正确,导致libclntsh.so这个文件没有找到