本文地址:http://blog.csdn.net/kongxx/article/details/7107683
在安装了cx_Oracle和Oracle Instant Client软件包之后,使用"import cx_Oracle"导入包的时候出现下面的问题
ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or directory此时是由于python在操作oracle数据库的时候需要用到oracle的一些库,而上面的问题就是说python需要的这些库不在环境的路径里,在linux上就是不在LD_LIBRARY_PATH环境变量里,此时时就需要把这些库路径加到LD_LIBRARY_PATH中
$ whereis oracle
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/oracle/11.2/client/lib再次运行测试,上面的问题没有了。
参考资料:
cx-oracle: http://cx-oracle.sourceforge.net/
Instant Client: http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
Using Python With Oracle Database 11g: http://www.oracle.com/technetwork/articles/dsl/python-091105.html

在Linux环境下,通过将Oracle库路径加入LD_LIBRARY_PATH,解决了使用cx_Oracle导入包时出现的libclntsh.so.10.1错误。详细步骤包括检查Oracle安装目录、修改环境变量并重新测试。

被折叠的 条评论
为什么被折叠?



