libclntsh.so:无法打开共享对象文件:Centos 8和python没有此类文件或目录 [英] libclntsh.so: cannot open shared object file: No such file or directory Centos 8 and python

查看:157
本文介绍了libclntsh.so:无法打开共享对象文件:Centos 8和python没有此类文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将python cx_Oracle与Centos 8中的oracle客户端库连接,我已经按照

i'm trying connect python cx_Oracle with the oracle client library in Centos 8, I have followed the steps showed in https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html, the rpm packages don't work so i used the zip package and config the LD_LIBRARY_PATH to the dir where i unzip the oracle files, in this case: /opt/oracle/lib.

运行脚本时,我得到:

cx_Oracle.DatabaseError:DPI-1047:无法找到64位Oracle客户端库:"/opt/oracle/lib/libclntsh.so:无法打开共享对象文件:没有这样的文件或目录".请参见 https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html寻求帮助

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

但是如果我运行:找到/opt/oracle/lib/libclntsh.so,它可以正常工作,并且文件在那里,根据错误消息,它的env变量正确,但是如果有人有任何建议,脚本仍然不起作用要解决此问题,我将非常感激.

but if i run: find /opt/oracle/lib/libclntsh.so it's works and the file is there, the env variable it's right according to the error message, but the script still not working, if anyone has any suggestions to fix this i would really appreciate it.

更新:当我设置DPI_DEBUG_LEVEL = 64时,我得到以下输出:

Update: when i set DPI_DEBUG_LEVEL=64 i get the following output:

ODPI [04293] 2021-04-10 15:51:06.109: ODPI-C 4.1.0
ODPI [04293] 2021-04-10 15:51:06.109: debugging messages initialized at level 64
ODPI [04293] 2021-04-10 15:51:06.110: Context Parameters:
ODPI [04293] 2021-04-10 15:51:06.110: Environment Variables:
ODPI [04293] 2021-04-10 15:51:06.110:     ORACLE_HOME => "/opt/oracle"
ODPI [04293] 2021-04-10 15:51:06.110:     LD_LIBRARY_PATH => "/opt/oracle/lib"
ODPI [04293] 2021-04-10 15:51:06.110: check module directory
ODPI [04293] 2021-04-10 15:51:06.110: module name is /usr/local/lib64/python3.6/site-packages/cx_Oracle.cpython-36m-aarch64-linux-gnu.so
ODPI [04293] 2021-04-10 15:51:06.110: load in dir /usr/local/lib64/python3.6/site-packages
ODPI [04293] 2021-04-10 15:51:06.110: load with name /usr/local/lib64/python3.6/site-packages/libclntsh.so
ODPI [04293] 2021-04-10 15:51:06.110: load by OS failure: /usr/local/lib64/python3.6/site-packages/libclntsh.so: cannot open shared object file: No such file or directory
ODPI [04293] 2021-04-10 15:51:06.110: load with OS search heuristics
ODPI [04293] 2021-04-10 15:51:06.110: load with name libclntsh.so
ODPI [04293] 2021-04-10 15:51:06.110: load by OS failure: libclntsh.so: cannot open shared object file: No such file or directory
ODPI [04293] 2021-04-10 15:51:06.110: load with name libclntsh.so.19.1
ODPI [04293] 2021-04-10 15:51:06.110: load by OS failure: libclntsh.so.19.1: cannot open shared object file: No such file or directory
ODPI [04293] 2021-04-10 15:51:06.110: load with name libclntsh.so.18.1
ODPI [04293] 2021-04-10 15:51:06.110: load by OS failure: libclntsh.so.18.1: cannot open shared object file: No such file or directory
ODPI [04293] 2021-04-10 15:51:06.110: load with name libclntsh.so.12.1
ODPI [04293] 2021-04-10 15:51:06.110: load by OS failure: libclntsh.so.12.1: cannot open shared object file: No such file or directory
ODPI [04293] 2021-04-10 15:51:06.110: load with name libclntsh.so.11.1
ODPI [04293] 2021-04-10 15:51:06.110: load by OS failure: libclntsh.so.11.1: cannot open shared object file: No such file or directory
ODPI [04293] 2021-04-10 15:51:06.110: load with name libclntsh.so.20.1
ODPI [04293] 2021-04-10 15:51:06.110: load by OS failure: libclntsh.so.20.1: cannot open shared object file: No such file or directory
ODPI [04293] 2021-04-10 15:51:06.110: load with name libclntsh.so.21.1
ODPI [04293] 2021-04-10 15:51:06.110: load by OS failure: libclntsh.so.21.1: cannot open shared object file: No such file or directory
ODPI [04293] 2021-04-10 15:51:06.110: check ORACLE_HOME
ODPI [04293] 2021-04-10 15:51:06.110: load in dir /opt/oracle/lib
ODPI [04293] 2021-04-10 15:51:06.110: load with name /opt/oracle/lib/libclntsh.so
ODPI [04293] 2021-04-10 15:51:06.110: load by OS failure: /opt/oracle/lib/libclntsh.so: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "cdr_parser.py", line 387, in <module>
    main()

该脚本仍然无法正常工作.

And the script still not working.

更新2:当我运行时:文件/opt/oracle/lib/libclntsh.so我得到:

Update 2: when i run: file /opt/oracle/lib/libclntsh.so i get:

/opt/oracle/lib/libclntsh.so: symbolic link to libclntsh.so.21.1

并运行ldd/opt/oracle/lib/libclntsh.so,输出为:

and running ldd /opt/oracle/lib/libclntsh.so the output is:

not a dynamic executable

我还验证了libaio和liabio-devel的安装,这是正确的,我的操作系统的版本是64位,而instanclient也是64位.

Also, i verified libaio and liabio-devel install and it's correct, my Os's version is 64 bits and the instanclient is 64 bit too.

推荐答案

看看错误消息中链接的文档,尤其是

Take a look at the documentation that was linked in the error message, in particular the troubleshooting section. In particular, set the environment variable DPI_DEBUG_LEVEL to the value 64 and run your script again. That will tell you all of the locations that are being searched and what the result of that attempt was. If this doesn't help, please update your question with the logged results. That may be enough to help further.

正如克里斯所说,在使用即时客户端时,请勿设置环境变量 ORACLE_HOME .此外,显示 file/opt/oracle/lib/libclntsh.so ldd/opt/oracle/lib/libclntsh.so 的结果,并以此更新您的问题信息.

as Chris mentioned, don't set the environment variable ORACLE_HOME when using the instant client. In addition, show the results of file /opt/oracle/lib/libclntsh.so and ldd /opt/oracle/lib/libclntsh.so and update your question with this information.

这篇关于libclntsh.so:无法打开共享对象文件:Centos 8和python没有此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆