尝试在Centos上安装Python 3.4的cx_Oracle。 我已经安装了Oracle客户端11.2.0.1(实际上有两个副本,因为一个需要加密连接而另一个不需要,所以我有/usr/lib/oracle/11.2/client64和/usr/lib/oracle/11.2.99 / client64)
$ echo $ORACLE_HOME
/usr/lib/oracle/11.2/client64
$ python3.4 --version
Python 3.4.3
我安装了SDK:
$ ls -all $ORACLE_HOME/sdk/include
total 1640
drwxrwxr-x 2 root root 4096 Aug 15 2009 .
drwxrwxr-x 4 root root 4096 Aug 15 2009 ..
-r-xr-xr-x 1 root root 42534 Aug 15 2009 ldap.h
-r--r--r-- 1 root root 34157 Aug 15 2009 nzerror.h
-r--r--r-- 1 root root 74787 Aug 15 2009 nzt.h
-r--r--r-- 1 root root 11586 Aug 15 2009 occiAQ.h
-r--r--r-- 1 root root 34750 Aug 15 2009 occiCommon.h
-r--r--r-- 1 root root 70685 Aug 15 2009 occiControl.h
-r--r--r-- 1 root root 39751 Aug 15 2009 occiData.h
-r--r--r-- 1 root root 2115 Aug 15 2009 occi.h
-r--r--r-- 1 root root 24778 Aug 15 2009 occiObjects.h
-r-xr-xr-x 1 root root 7203 Aug 15 2009 oci1.h
-r--r--r-- 1 root root 10361 Aug 15 2009 oci8dp.h
-r--r--r-- 1 root root 431290 Aug 15 2009 ociap.h
-r-xr-xr-x 1 root root 6204 Aug 15 2009 ociapr.h
-r--r--r-- 1 root root 43001 Aug 15 2009 ocidef.h
-r-xr-xr-x 1 root root 4048 Aug 15 2009 ocidem.h
-r--r--r-- 1 root root 11339 Aug 15 2009 ocidfn.h
-r--r--r-- 1 root root 8953 Aug 15 2009 ociextp.h
-r--r--r-- 1 root root 170958 Aug 15 2009 oci.h
-r-xr-xr-x 1 root root 6494 Aug 15 2009 ocikpr.h
-r--r--r-- 1 root root 4670 Aug 15 2009 ocixmldb.h
-r--r--r-- 1 root root 94528 Aug 15 2009 ocixstream.h
-r--r--r-- 1 root root 23266 Aug 15 2009 odci.h
-r-xr-xr-x 1 root root 6540 Aug 15 2009 oratypes.h
-r--r--r-- 1 root root 15083 Aug 15 2009 orid.h
-r--r--r-- 1 root root 102775 Aug 15 2009 ori.h
-r--r--r-- 1 root root 157901 Aug 15 2009 orl.h
-r--r--r-- 1 root root 42626 Aug 15 2009 oro.h
-r--r--r-- 1 root root 116645 Aug 15 2009 ort.h
-r-xr-xr-x 1 root root 9892 Aug 15 2009 xa.h
我也安装了python-devel:
$ sudo yum install python34u-devel
Loaded plugins: security
Setting up Install Process
Package python34u-devel-3.4.3-2.ius.centos6.x86_64 already installed and latest version
Nothing to do
但是,安装失败了:
$ sudo pip3.4 install cx_oracle
Collecting cx-oracle
Using cached cx_Oracle-5.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-zo2vjgvs/cx-oracle/setup.py", line 201, in <module>
includeDirs = FindInstantClientRPMInclude(instantClientRPMLib)
File "/tmp/pip-build-zo2vjgvs/cx-oracle/setup.py", line 144, in FindInstantClientRPMInclude
raise DistutilsSetupError("cannot locate Oracle Instant Client " \
distutils.errors.DistutilsSetupError: cannot locate Oracle Instant Client SDK RPM header files
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-zo2vjgvs/cx-oracle
答案 0 :(得分:3)
好吧,经过大量的试验和错误后,问题就出现了 我用这两个Oracle客户端库分隔了“需要加密”和“不需要加密”的客户端。一旦我删除了第二个,安装的cx_Oracle就行了。
/usr/lib/oracle/11.2/client64
/usr/lib/oracle/11.2.99/client64
遗憾的是,甲骨文没有办法设置加密PER CONNECTION,只能为整个客户端设置,所以我需要两个客户端,如果我想有时以加密方式连接,有时没有加密。