2017-02-15 123 views
0

类型错误安装cx_Oracle:不支持Python数据类型:文件错误在Windows 7

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. 

Command prompt error

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\ 

简称this question。问题依然存在。我使用Windows 7 64位PC。我该如何解决这个问题?

+0

对于cx_Oracle邮件列表,这可能是一个更好的问题:https://sourceforge.net/p/cx-oracle/mailman/search/?q=windows – Scovetta

回答

0

检查您正在使用的Python类型 - 32位或64位。然后转到PyPI(https://pypi.python.org/pypi/cx_Oracle/5.2.1)并下载正确的版本(正确的Python版本以及32位或64位,具体取决于您使用的Python)。预构建的二进制文件应该能够让你解决第一个问题。

您还需要确保已安装Oracle客户端并且它位于PATH中。您可以从此位置获得Oracle即时客户端(http://www.oracle.com/technetwork/database/features/instant-client/index.html),并按照该页面上的说明进行操作。再次确保您下载32位或64位,具体取决于您正在使用的Python和cx_Oracle的版本。一切都必须匹配,否则你会得到你注意到的问题。