cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libaio.so.1

 

安装 centos7镜像里面安装cx_Oracle,运行报错

import cx_Oracle as oracle
dsnStr = oracle.makedsn('22.21.7.27', '11596', service_name='xe')
db = oracle.connect('test', 'test', dsn=dsnStr)

cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libaio.so.1: cannot open shared object file: No such file or directory". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help

报错原因是没有安装instantclient 数据库客户端,这是oracle独有的,需要安装oracle-instantclient。

1.我的oracle 是生产版本19,测试版本12.1.0.2,我下载 oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm,根据自己的oracle和服务器选择版本

2. docker cp oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm    镜像id:/app

yum -y install ./oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm    #安装

sh -c "echo /usr/lib/oracle/12.1/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf"       #软连接

ldconfig                             #ldconfig是一个动态链接库管理命令 为了让动态链接库为系统所共享,

 参考文档:https://www.shuzhiduo.com/A/gAJGYxl0dZ/

posted @   简单音乐  阅读(930)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
点击右上角即可分享
微信分享提示