Python Anaconda - error importing cx_Oracle in command window

I have installed Python 2.7.7 :: Anaconda 2.0.1 (64-bit). I am currently trying to run the "import cx_Oracle" command. I ran easy_install, which will successfully add the cx_Oracle egg to the "site_packages" folder in the anaconda directory, getting the message "Installed c: \ fast \ anaconda \ 2.0.1 \ lib \ site-packages \ cx_oracle-5.1.3-py2.7- mutual amd64 ". Now when I try to execute the "import cx_Oracle" command in python terminal, I get the error "Import failed: DLL load failed:% 1 is not a valid Win32 application". I tried to install a specific 32 bit version of cx_Oracle, but it still produced the same output "Installed c: \ fast \ anaconda \ 2.0.1 \ lib \ site-packages \ cx_oracle-5.1.3-py2.7-win- amd64 ". Has anyone had time to fix this?

+3


source to share


3 answers


You can install cx_Oracle

Python package like this :

conda install -c https://conda.anaconda.org/anaconda cx_oracle

      



Among other things, it will take care of installing the correct Oracle client:

C:\Anaconda>conda install -c https://conda.anaconda.org/anaconda cx_oracle
Fetching package metadata: ......
Solving package specifications: .
Package plan for installation in environment C:\Anaconda:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    oracle-instantclient-11.2.0.4.0|                0        50.9 MB
    cx_oracle-5.1.2            |           py27_0          55 KB
    pyyaml-3.11                |           py27_2         167 KB
    requests-2.8.0             |           py27_0         598 KB
    setuptools-18.3.2          |           py27_0         647 KB
    conda-3.18.1               |           py27_0         215 KB
    ------------------------------------------------------------
                                           Total:        52.5 MB

The following NEW packages will be INSTALLED:

    cx_oracle:            5.1.2-py27_0
    oracle-instantclient: 11.2.0.4.0-0

The following packages will be UPDATED:

    conda:                3.16.0-py27_0 --> 3.18.1-py27_0
    pyyaml:               3.11-py27_1   --> 3.11-py27_2
    requests:             2.7.0-py27_0  --> 2.8.0-py27_0
    setuptools:           18.1-py27_0   --> 18.3.2-py27_0

Proceed ([y]/n)? y

Fetching packages ...
oracle-instant 100% |###############################| Time: 0:00:04  11.48 MB/s
cx_oracle-5.1. 100% |###############################| Time: 0:00:00   1.77 MB/s
pyyaml-3.11-py 100% |###############################| Time: 0:00:00   2.14 MB/s
requests-2.8.0 100% |###############################| Time: 0:00:00   3.82 MB/s
setuptools-18. 100% |###############################| Time: 0:00:00   4.25 MB/s
conda-3.18.1-p 100% |###############################| Time: 0:00:00   1.11 MB/s
Extracting packages ...
[      COMPLETE      ]|##################################################| 100%
Unlinking packages ...
[      COMPLETE      ]|##################################################| 100%
Linking packages ...
[      COMPLETE      ]|##################################################| 100%

      

+3


source


I had the 32 bit version of the oracle client installed. Once I installed 64 bit it worked fine.



+1


source


Oracle client and Python platform must be the same (64 or 32 bit)

Determine your current platform using:

  import platform
  platform.architecture()

      

If that doesn't help the recording, there is a problem with the default version 5.3. You can try to install version 6.0b2

 python -m pip install cx_Oracle --pre

      

When Anaconda fails. You can try pip.

Anaconda 3.5 (64-bit Windows) Install cx_Oracle

0


source







All Articles