Python 2.7 命令窗口中的python导入cx_Oracle错误

Python 2.7 命令窗口中的python导入cx_Oracle错误,python-2.7,cx-oracle,Python 2.7,Cx Oracle,我在命令行中运行一些导入cx_Oracle的代码时遇到问题,尽管相同的代码在控制台中工作。为了通过命令行使其正常工作,我还需要设置其他内容吗 仅将一行代码“import cx_Oracle”保存为test.py 在ide(Spyder)中运行此行,iPython Notebook=>无问题 从保存.py文件的同一文件夹中打开命令行窗口,运行python test.py并遇到以下问题: import cx_Oracle ImportError: DLL load failed: %1 is not

我在命令行中运行一些导入cx_Oracle的代码时遇到问题,尽管相同的代码在控制台中工作。为了通过命令行使其正常工作,我还需要设置其他内容吗

  • 仅将一行代码“import cx_Oracle”保存为test.py
  • 在ide(Spyder)中运行此行,iPython Notebook=>无问题
  • 从保存.py文件的同一文件夹中打开命令行窗口,运行python test.py并遇到以下问题:

    import cx_Oracle
    ImportError: DLL load failed: %1 is not a valid Win32 application.
    
  • 不确定是否需要通过命令行设置其他内容来运行cx_Oracle?我尝试了所有关于设置路径、ORACLE_HOME和重新安装的建议,但都无法实现。我正在使用的版本是

    Python:2.7
    cx_Oracle:cx_Oracle-5.1.3-11g.win-amd64-py2.7
    即时客户端:12.1.0.0

    Windows:7 Enterprise

    我也发现了这种问题。 请看“不是有效的Win32应用程序”这句话,因此我决定将cx_Oracle更改为cx_Oracle-5.1.3-11g.win-32-py2.7。幸运的是,它确实有效