PythonがOracleデータベースを操作するときにImportError:libclntsh.so.10.1:cannot open shared object file:No such file orが表示されます


本住所: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