cx_Oracle ImportError: DLL load failed: %一 不是有效的 Win32 应用程序

cx_Oracle ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。

环境:

Win7 64位

Python2.7.2 64位

Oracle client 32位

 

cx_Oracle: Windows amd64 Installer (Oracle 11g, Python 2.7)

 

在python终端报错:

>>> import cx_Oracle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。
 

原因:

在64位系统上安装32位Oracle client,是因为要安装PLSQL Developer,但是货认不了64位的Oracle Client。所以现在导致现在的cx_Oralce认不到oci.dll的32位版本。

 

解决方法:

1.安装64位的oracle client

2.拷贝一个64位的 oci.dll 到%python_home%\Lib\site-packages 下