日期:2014-05-16  浏览次数:20798 次

linux下python连接oracle错误处理

在linux下安装cx_Oracle 使用“import cxOracle”导入时报错:

>>> import cx_Oracle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
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中

?

# export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib
?测试,问题得到解决。