我需要在Linux(Linux 2.6.18-371.1.2.el5 i686)上为Python 2.5安装cx_Oracle。我已经安装了Oracle客户端10.2.0.4。
我尝试了以下步骤:
1. 从http://sourceforge.net/projects/cx-oracle/files/
下载cx_Oracle tar.gz
。由于不知道有哪些版本适用于Python 2.5和Oracle客户端10.2.0.4,因此选用了cx_Oracle-5.1.tar.gz。解压后进入文件夹并运行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文件?
- 运行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
sudo mkdir $ORACLE_HOME/sdk/
sudo ln -s /usr/include/oracle/12.1/client $ORACLE_HOME/sdk/include
- Dennis Golomazov