Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
236 views
in Technique[技术] by (71.8m points)

python - Help installing cx_Oracle

I'm trying to install the cx_Oracle for Python 2.6, but it is failing. I don't know enough about C or MS Vis. Studio's compiler to even approach fixing it myself.

This is what is output on the command line:

C:pydevcx_Oracle-5.0.1>C:python26python setup.py install
running install
running build
running build_ext
building 'cx_Oracle' extension
C:Program FilesMicrosoft Visual Studio 9.0VCBINcl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:Oracleinstantclientsdkinclude -IC:p
ython26include -IC:python26PC /Tccx_Oracle.c /Fobuildemp.win32-2.6-11gReleasecx_Oracle.obj -DBUILD_VERSION=5.0.1
cx_Oracle.c
c:pydevcx_oracle-5.0.1StringVar.c(392) : warning C4018: '>' : signed/unsigned mismatch
c:pydevcx_oracle-5.0.1StringVar.c(417) : warning C4018: '>' : signed/unsigned mismatch
c:pydevcx_oracle-5.0.1ObjectVar.c(117) : warning C4018: '<' : signed/unsigned mismatch
c:pydevcx_oracle-5.0.1ObjectVar.c(134) : warning C4018: '<' : signed/unsigned mismatch
c:pydevcx_oracle-5.0.1Variable.c(331) : error C2036: 'void *' : unknown size
c:pydevcx_oracle-5.0.1Variable.c(878) : warning C4244: '=' : conversion from 'sb2' to 'sb1', possible loss of data
c:pydevcx_oracle-5.0.1Variable.c(914) : warning C4018: '<' : signed/unsigned mismatch
error: command '"C:Program FilesMicrosoft Visual Studio 9.0VCBINcl.exe"' failed with exit status 2

Does anyone have any idea how to fix this? (I also may have an issue with that cl.exe file, I think I remember seeing this as a problem somewhere else, but I have four Windows machines which could have had issue there.).

----------------------------- EDIT -----------------------------

The reason I do not use the pre-compiled installer is because when I try to run the module I get the following:

    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:Oracleinstantclient #The directory where the above files have been extracted.

More information

  • The current directory for the cx_Oracle's setup.py is C:pydevcx_Oracle-5.0.1
  • The version of Python is 2.6.3
  • The current directory for Python is C:Python26 -- to access python 2.6 -> type py26 on the command line and it will map to C:python26python
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Why don't you use a binary package like Windows Installer (Oracle 10g, Python 2.6)?

See http://cx-oracle.sourceforge.net/ for other binary packages


Addendum (as requested): you must ensure to use the cx_Oracle that :

  • set ORACLE_HOME if this environment variable doesn't exist (see this Oracle FAQ)
  • python can find oraocci11.dll for Oracle 11g, oraocci10.dll for Oracle 10g or oraclient9.dll for Oracle 9i by adding the folder (should be %ORACLE_HOME%/bin) where the DLL is in you PATH environment variable
  • use the correct binary package (i.e. built for the right Python/Oracle versions)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...