1. pip install cx_Oracle
2. instantclient_11_2 连接oracle数据
这里解压至:/opt/ 下
链接:https://pan.baidu.com/s/13mh2eJD7x3oUnS3__USAaA
提取码:qjxi
3. 测试连库
python
>>>import cx_Oracle
>>>conn = cx_Oracle("用户名/密码@ip:port/sid")
报错: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"
解决:
vi /etc/ld.so.conf
写入:/opt/instantclient_11_2
ldconfig
查看:/opt/instantclient_11_2 下.so文件
继续报错:
执行:ldd /opt/instantclient_11_2/libclntsh.so
安装:yum install libaio
再次连接即可