cx_Oracle: distutils.errors.DistutilsSetupError: Oracle include ファイルが見つかりません 質問する

cx_Oracle: distutils.errors.DistutilsSetupError: Oracle include ファイルが見つかりません 質問する

Linux (Linux 2.6.18-371.1.2.el5 i686) に Python 2.5 用の cx_Oracle をインストールする必要があります。Oracle クライアント 10.2.0.4 をインストールしました。

以下を試しました: 1.cx_Oracle tar.gzからダウンロードしますhttp://sourceforge.net/projects/cx-oracle/files/。リストされているバージョンのうち、どのバージョンが Python 2.5 および Oracle クライアント 10.2.0.4 に適しているかはわかりません。そのため、cx_Oracle-5.1.tar.gz を試してください。tar を解凍し、解凍されたフォルダーに移動して、python setup.py install を実行します。エラーが発生しました:

Traceback (most recent call last):
File "setup.py", line 187, in <module>
raise DistutilsSetupError("cannot locate Oracle include files")
distutils.errors.DistutilsSetupError: cannot locate Oracle include files

.bash_profile で Oracle パスを設定しました:

export ORACLE_HOME=/usr/oracle/10.2.0.4/client
export PATH=$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

このようなエラーを修正するには、cx_Oracle tar の別のバージョンが必要でしょうか?

  1. pip install cx_Oracle を実行します。エラーが発生しました:

cx-Oracle のダウンロード/解凍

Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement cx-Oracle
No distributions at all found for cx-Oracle

誰か私に正しい解決策をアドバイスしてもらえますか?

アップデート応答で提案した後、次のエラーが発生しました:

...
cx_Oracle.c:496: warning: passing argument 3 of âPyModule_AddIntConstantâ makes integer from  pointer without a cast
cx_Oracle.c:497: error: âOCI_UCBTYPE_EXITâ undeclared (first use in this function)
cx_Oracle.c:497: warning: passing argument 3 of âPyModule_AddIntConstantâ makes integer from pointer without a cast
cx_Oracle.c:498: error: âOCI_UCBTYPE_REPLACEâ undeclared (first use in this function)
cx_Oracle.c:498: warning: passing argument 3 of âPyModule_AddIntConstantâ makes integer from pointer without a cast
error: command 'gcc' failed with exit status 1

ベストアンサー1

setup.py を実行すると、ORACLE_HOME 上のこれらのフォルダーがチェックされます。

possibleIncludeDirs = ["rdbms/demo", "rdbms/public", "network/public",
        "sdk/include"]

また、インスタント クライアントは、oci.h などのインクルード ファイルを /usr/include/oracle//client に配置することがあります。ORACLE_HOME の下に 'include' ディレクトリがない場合は、そのディレクトリへのシンボリック リンクを作成します。

sudo ln -s /usr/include/oracle/11.2/client $ORACLE_HOME/include

どうやら、クライアントSDK

おすすめ記事