Problems importing cx_oracle in python 3.4 64 bits

Asked

Viewed 334 times

4

I have a problem with cx_oracle in 64 bit python. 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 strange because the file is for windows 64 bits and even then, it complains for not being a 32 bit application. How can I get around this problem?

1 answer

1

Try to install by Pip as reported 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 bits, it will look for a 64-bit version of the library, and if it does not exist, it will tell you that none is available. It is usually safer than installing "manually". Python is full of these discrepancies, so I highly recommend using Pip whenever possible.

EDIT:

How evidenced in that matter, in case of error Unable to find vcvarsall.bat, open CMD and use the SET command 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%
  • I did this @Ericson Willians, but it was a mistake. error: Unable to find vcvarsall.bat

  • @fredsilva, I edited the answer with a solution to this error.

  • I did the procedure you said, but the error persists.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.