Windows上的easy_install cx_Oracle(Python软件包) [英] easy_install cx_Oracle (python package) on Windows
问题描述
因此,我找到了帮助安装cx_Oracle ,但仍然失败。我从oracle下载了最新的InstantClient,并将ORACLE_HOME设置为提取文件的位置(直接使用,并在ORACLE_HOME值和文件之间使用bin文件夹),但是easy_install在运行setup.py时弹出错误,说可以。 t找到Oracle包含文件。我确实注意到文件夹中只有11g dll,我是否需要所有3个驱动程序才能完成安装?如果是这样,我什至可以从哪里得到它们?
So I found Help installing cx_Oracle but am still stuck. I downloaded the latest instantclient from oracle, and set ORACLE_HOME to the location of the extracted files (both direct and with a bin folder between the ORACLE_HOME value and the files), but easy_install is popping an error when running setup.py saying it can't locate the Oracle include files. I did notice that only the 11g dll is in the folder, do I need all 3 drivers present for setup to complete? If so, where do I even get them?
推荐答案
老实说,从以下其中一个安装cx_Oracle容易得多二进制安装程序,而不是源代码。
Honestly it is a hell of a lot easier to install cx_Oracle from one of the binary installers they have, than from source.
下载最新版本的basic ,sqlplus和sdk程序包适合您的体系结构(32位或64位):
Download the latest version of basic, sqlplus and sdk packages that fit your architecture (32 or 64bits):
-
oracle-instantclient< version> -basic-< version_full>。< arch> .rpm
-
oracle-instantclient< version> -sqlplus-< version_full>。< arch> ; .rpm
-
oracle-instantclient< version> -devel-< version_full>。< arch> .rpm
。
oracle-instantclient<version>-basic-<version_full>.<arch>.rpm
oracle-instantclient<version>-sqlplus-<version_full>.<arch>.rpm
oracle-instantclient<version>-devel-<version_full>.<arch>.rpm
.
使用以下命令安装RPM g外星人。例如,在撰写本文时:
Install the RPMs using alien. For example, at the time of this writing:
$ sudo alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
添加必要的环境变量(我亲自做了在 / etc / environment
中,然后注销/重新登录以重新加载环境):
Add necessary environment variables (I personally did put it in /etc/environment
then logoff/back in to reload the env):
ORACLE_HOME=/usr/lib/oracle/<version>/client64/lib/
LD_LIBRARY_PATH=/usr/lib/oracle/<version>/client64/lib/
$ sudo ln -s /usr/include/oracle/<version>/client $ORACLE_HOME/include # for 32bits arch, OR
$ sudo ln -s /usr/include/oracle/<version>/client64 $ORACLE_HOME/include # for 64bits arch
创建 /etc/ld.so.conf.d/oracle-instantclient<version>-basic.conf
和 /etc/ld.so.conf.d/oracle.conf
(适用于最新的v版本,至少从12.1开始)
Create /etc/ld.so.conf.d/oracle-instantclient<version>-basic.conf
and /etc/ld.so.conf.d/oracle.conf
(for more recent versions, at least since 12.1) containing:
/lib
/usr/lib/oracle/<version>/client/lib ; for 32bits arch, OR
/usr/lib/oracle/<version>/client64/lib ; for 64bits arch
重新加载ldconfig缓存(使用 -v
标志(如果需要一些详细信息):
Reload ldconfig cache (use -v
flag if you want some verbose):
$ sudo ldconfig
您可能需要安装 libaio1
假定我们已经安装了Oracle Instant Client 10,则可以使用不同的替代方法来安装 cx_Oracle :
Assuming we have installed Oracle Instant Client 10, you have different alternatives to install cx_Oracle:
- 使用 pip :
$ pip install cx_oracle
(仅适用于Linux) - 从 cx_oracle PyPI 网站 下载installer / .tar.gz文件 >
- Install with pip:
$ pip install cx_oracle
(linux only) - Download the installer/.tar.gz file from the cx_oracle PyPI site
较旧的版本(低于5.1.2的版本是.msi和.rpm文件)可以从此处。使用Alien安装RPM。例如,在撰写本文时:
$ sudo alien -i cx_Oracle-5.0-10g-py25-1.x86.rpm
Older versions (version less than 5.1.2 are .msi and .rpm files) can be downloaded from here. Install the RPMs using alien. For example, at the time of this writing:
$ sudo alien -i cx_Oracle-5.0-10g-py25-1.x86.rpm
要测试, python -c'import cx_Oracle; print cx_Oracle’
应该返回带有其版本的模块。
To test, python -c 'import cx_Oracle; print cx_Oracle'
should return the modules with its version.
这篇关于Windows上的easy_install cx_Oracle(Python软件包)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!