gpt4 book ai didi

python - 帮助安装 cx_Oracle

转载 作者:IT老高 更新时间:2023-10-28 20:33:51 26 4
gpt4 key购买 nike

我正在尝试为 Python 2.6 安装 cx_Oracle,但它失败了。我对 C 或 MS Vis 知之甚少。 Studio 的编译器甚至可以自己修复它。

这是命令行上的输出:

C:\pydev\cx_Oracle-5.0.1>C:\python26\python setup.py install
running install
running build
running build_ext
building 'cx_Oracle' extension
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Oracle\instantclient\sdk\include -IC:\p
ython26\include -IC:\python26\PC /Tccx_Oracle.c /Fobuild\temp.win32-2.6-11g\Release\cx_Oracle.obj -DBUILD_VERSION=5.0.1
cx_Oracle.c
c:\pydev\cx_oracle-5.0.1\StringVar.c(392) : warning C4018: '>' : signed/unsigned mismatch
c:\pydev\cx_oracle-5.0.1\StringVar.c(417) : warning C4018: '>' : signed/unsigned mismatch
c:\pydev\cx_oracle-5.0.1\ObjectVar.c(117) : warning C4018: '<' : signed/unsigned mismatch
c:\pydev\cx_oracle-5.0.1\ObjectVar.c(134) : warning C4018: '<' : signed/unsigned mismatch
c:\pydev\cx_oracle-5.0.1\Variable.c(331) : error C2036: 'void *' : unknown size
c:\pydev\cx_oracle-5.0.1\Variable.c(878) : warning C4244: '=' : conversion from 'sb2' to 'sb1', possible loss of data
c:\pydev\cx_oracle-5.0.1\Variable.c(914) : warning C4018: '<' : signed/unsigned mismatch
error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2

有人知道如何解决这个问题吗?(我也可能对那个 cl.exe 文件有问题,我想我记得在其他地方看到过这个问题,但我有四台 Windows 机器可能在那里有问题。)。

-------------- 编辑 -------------- ---------------

我不使用预编译安装程序的原因是因为当我尝试运行该模块时,我得到以下信息:

    Python 2.6.3 (r263rc1:75186, Oct  2 2009, 20:40:30) [MSC v.1500 32 bit (Intel)] on win32    Type "help", "copyright", "credits" or "license" for more information.    >>> import cx_Oracle    Traceback (most recent call last):      File "", line 1, in     ImportError: DLL load failed: The specified module could not be found.

I assume that means that it has not been properly installed. If someone can tell me what I did wrong here, that would also be a perfectly acceptable answer.

----------------------------- EDIT2 -----------------------------

I have retrieved all files from Oracle's Basic Client version 11.1.0.7. I have not tried installing a more substantial client. I am downloading one now.

%ORACLE_HOME%=C:\Oracle\instantclient\ #The directory where the above files have been extracted.

更多信息

  • cx_Oracle 的 setup.py 的当前目录是 C:\pydev\cx_Oracle-5.0.1
  • Python的版本是2.6.3
  • Python的当前目录是C:\Python26 -- 访问python 2.6 -> 在命令行输入py26会映射到C:\python26\python

最佳答案

为什么不使用像 Windows Installer (Oracle 10g, Python 2.6) 这样的二进制包? ?

http://cx-oracle.sourceforge.net/对于其他二进制包


附录(根据要求):您必须确保使用 cx_Oracle :

  • 如果此环境变量不存在,请设置 ORACLE_HOME(参见 Oracle FAQ)
  • python 可以通过添加DLL 在您的 PATH 环境变量中的文件夹(应该是 %ORACLE_HOME%/bin)
  • 使用正确的二进制包(即为正确的 Python/Oracle 版本构建)

关于python - 帮助安装 cx_Oracle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1711408/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com