本文地址:http://blog.csdn.net/kongxx/article/details/7107683
在安装了cx_Oracle和Oracle Instant Client软件包之后,使用"import cx_Oracle"导入包的时候出现下面的问题
此时是由于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