2017-02-15 125 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的版本。一切都必須匹配,否則你會得到你注意到的問題。