简体   繁体   中英

Error installing cx_Oracle on Windows 7

TypeError: unsupported Python data type: file

Spyder控制台错误 :

In [9]: import cxOracle
Traceback (most recent call last):

  File "<ipython-input-9-d1ecebcba3d2>", line 1, in <module>
    import cx_Oracle

ImportError: DLL load failed: %1 is not a valid Win32 application.

命令提示错误 :

C:\Users\system.labuser>pip install cx_Oracle
Collecting cs_Oracle
  Using cached cx_Oracle-5.2.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback <most recent call last>:
      File "<string>", line 1, in <module>
      File "c:\users\system~1.lab\appdata\local\temp\pip-build-5bnyuh\cx-Oracle\setup.py", line 170, in <module>
        raise DistutilsSetupError<"cannot locate an Oracle software " \
    distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\system~1.lab\appdata\local\temp\pip-build-5bnyuh\cx-Oracle\

Referred to this question . Problem still persists. I use a Windows 7 64 bit PC. How can I solve this?

Check to see what type of Python you are using -- 32-bit or 64-bit. Then go to PyPI ( https://pypi.python.org/pypi/cx_Oracle/5.2.1 ) and download the correct version (correct Python version and either 32-bit or 64-bit depending on what Python you are using). The prebuilt binaries should get you past the first problem.

You also need to ensure that you have an Oracle client installed and that it is in your PATH. You can get the Oracle instant client from this location ( http://www.oracle.com/technetwork/database/features/instant-client/index.html ) and follow the instructions on that page as well. Again, make sure that you download 32-bit or 64-bit depending on what version of Python and cx_Oracle you are using. Everything must match or you will get the problems you are noting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM