I have a situation very much like the one at ImportError: DLL load failed: %1 is not a valid Win32 application, but the answer there isn\'t working for me.
My Python
For me the problem was that I was using different versions of Python in the same Eclipse project. My setup was not consistent with the Project Properties and the Run Configuration Python versions.
In Project > Properties > PyDev, I had the Interpreter set to Python2.7.11.
In Run Configurations > Interpreter, I was using the Default Interpreter. Changing it to Python 2.7.11 fixed the problem.
First I copied cv2.pyd
from /opencv/build/python/2.7/x86
to C:/Python27/Lib/site-packeges
. The error was
"RuntimeError: module compiled against API version 9 but this version of numpy is 7"
Then I installed numpy-1.8.0-win32-superpack-python2.7.exe
and opencv works fine.
>>> import cv2
>>> print cv2.__version__
2.4.13
Unofficial Windows Binaries for Python Extension Packages
you can find any python libs from here
I had the same problem. Here's what I did:
I downloaded pywin32 Wheel file from here, then
I uninstalled the pywin32 module. To uninstall execute the following command in Command Prompt.
pip uninstall pywin32
Then, I reinstalled pywin32. To install it, open the Command Prompt in the same directory where the pywin32 wheel file lies. Then execute the following command.
pip install <Name of the wheel file with extension>
Wheel file will be like: piwin32-XXX-cpXX-none-win32.whl
It solvs the problem for me. You may also like to give it a try. Hope it work for you as well.
I copied cv2.pyd
file from /opencv/build/python/2.7/x86
folder instead of from /x64
folder to C:/Python27/Lib/site-packeges
. I followed rest of the instructions provided here.
Added by someone else, not verified: I also copy file cv2.pyd
to folder C:/Python27/Lib/site-packages/cv2
. It works.
So I had problems installing vtk under windows (as I use python 3.7 there is no binary available so far just for older python versions pip install vtk is not working)
I did wrote python in my cmd:
Python 3.7.3 on win32
So I now know I have python 3.7.3 runing on a 32 bit.
I then downloaded the correct wheel at VTK‑8.2.0‑cp37‑cp37m‑win32.whl
Next I instlled that wheel:
pip install VTK-8.2.0-cp37-cp37m-win32.whl
Then I tested it and it worked:
python
import vtk