Problems importing cx_oracle in python 3.4 64 bits

4

I have a problem with cx_oracle in python 64 bit. I installed this version of cx_oracle: cx_Oracle-5.2.1-11g.win-amd64-py3.4. But when importing in python import cx_Oracle , the following error occurs:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import cx_Oracle
ImportError: DLL load failed: %1 não é um aplicativo Win32 válido.

I found it strange because the file is for 64-bit windows and even then, it complains about not being a 32-bit application. How can I work around this problem?

    
asked by anonymous 24.05.2016 / 20:03

1 answer

1

Try to install by pip as you are informed in cx_Oracle page in Source Forge .

pip install cx_Oracle

Pip always checks the Python version when downloading the library. If your Python is 64-bit, it will look for a 64-bit version of the library, and if it does not exist, it will report that there are none available. It is usually safer than installing "manually". Python is full of these discrepancies, so I highly recommend using the pip whenever possible.

EDIT:

As evidenced by in this question , in the case of error Unable to find vcvarsall.bat , open the CMD and use the command with SET corresponding to the version of your Visual Studio (If not, install):

  • Visual Studio 2010 (VS10): SET VS90COMNTOOLS=%VS100COMNTOOLS%
  • Visual Studio 2012 (VS11): SET VS90COMNTOOLS=%VS110COMNTOOLS%
  • Visual Studio 2013 (VS12): SET VS90COMNTOOLS=%VS120COMNTOOLS%
  • Visual Studio 2015 (VS14): SET VS90COMNTOOLS=%VS140COMNTOOLS%
25.05.2016 / 06:26