Py第十六问 ImportError: DLL load failed: %1 is not a valid Win32 application

Getting 64bit Python up and running with 64 bit packages on Windows is a bit of a pain.

Install WinPython 2.7.5.1 64bit, https://code.google.com/p/winpython/

Register the installation with windows with “WinPython Control Panel.exe” by going “Advanced” -> “Register distribution”

Now find a 64bit compilation of the package you want. Christoph Gohlke provides a major public good by hosting precompiled packages at http://www.lfd.uci.edu/~gohlke/pythonlibs/

In my case I needed opencv which meant downloading and installing “opencv-python-2.4.5.win-amd64-py2.7.‌exe”

Then in python import as usual “import cv”

Troubleshooting

If the package can’t find your winpython installation then you might not have registered it as described above.

If your installation of Spyder stops working, you may have to reset your PATH environmental variables. You can view and edit environmental variables more easily with a freeware program like Rapid Environment Editor. In my case, I had to uninstall all of my python installations and packages before it would start working again.

If you receive the following error:

Traceback (most recent call last):
  File "", line 1, in 
ImportError: DLL load failed: %1 is not a valid Win32 application.

Then it probably means you have 64 bit python but a 32 bit version of your package. Either find a precompiled version that is listed as 64 bit or you’ll have to compile it yourself.

Py第十六问 ImportError: DLL load failed: %1 is not a valid Win32 application_第1张图片

原因是截图中的框框位数需要一致

Py第十六问 ImportError: DLL load failed: %1 is not a valid Win32 application_第2张图片

本次是因为oracle驱动用了64位的客户端,而python cx_Oracle都是32位的,换成32位的oracle驱动解决

你可能感兴趣的:(Python)