cx_Oracle:distutils.errors.DistutilsSetupError:即使使用SDK也无法找到Oracle包含文件 [英] cx_Oracle: distutils.errors.DistutilsSetupError: cannot locate Oracle include files even with SDK

查看:80
本文介绍了cx_Oracle:distutils.errors.DistutilsSetupError:即使使用SDK也无法找到Oracle包含文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在Centos上为Python 3.4安装cx_Oracle。
我已经安装了Oracle客户端11.2.0.1(实际上有两个副本,因为一个需要加密连接,而另一个则不需要,因此我有/usr/lib/oracle/11.2/client64和/ usr / lib / oracle /11.2.99/client64)

Trying to install cx_Oracle for Python 3.4 on Centos. I have installed Oracle client 11.2.0.1 (actually has two copies, as one requires encrypted connection while the other doesn't, so I have /usr/lib/oracle/11.2/client64 and /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:

I also have python-devel installed:

$ 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


推荐答案

好吧,经过大量的试验和错误后,原来问题出在我有
这两个Oracle客户端库,我用来分隔需要加密和不需要加密客户端。一旦删除了第二个客户端,安装的cx_Oracle就可以了。 / p>

Well, after lot of trial and errors it turns out the problem was that I had these two Oracle client libraries I used to separate an "encryption required" and "encryption not required" client. As soon as I removed the second one, the cx_Oracle installed just worked.

/usr/lib/oracle/11.2/client64

/usr/lib/oracle/11.2.99/client64

这是假的e,Oracle无法设置每个连接的加密方式,只能为整个客户端设置一个加密方式,因此,如果我想有时以加密方式连接而有时不进行加密,则需要两个客户端。

It is a shame, that Oracle doesn't have a way to set encryption PER CONNECTION, only can be set for the whole client, so I need two clients if I want to connection sometimes on an encrypted way and sometimes with no encryption.

这篇关于cx_Oracle:distutils.errors.DistutilsSetupError:即使使用SDK也无法找到Oracle包含文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆