简体   繁体   中英

python, windows 7, can't import cv2

I know this subject has been brought up before, I've tried all the fixes I've found to no avail. When i try to import cv2 i get the message:

DLL load failed: %1 is not a valid Win32 application.

I'm running python 2.7 on windows 7, 64bit . I've tried installing cv2 using:

python -m pip install cv2

as well as installing the .whl file ( opencv_python-2.4.12-cp27-none-win_amd64.whl ) the same way. Both times, cmd prompt tells me they've installed correctly, but I still can't import cv2 .

The next thing i tried was downloading the latest version of opencv and following the directions here to install it.

I also tried including the paths to the .pyd file in my environment variables:

c:\\opencv\\build\\python\\2.7\\x64; c:\\Python27\\Lib\\site-packages

I still get the error upon trying to import cv2:

DLL load failed: %1 is not a valid Win32 application.

next, i tried the solved fix proposed in this thread next, I've tried the solved fix proposed in this thread ImportError: DLL load failed: %1 is not a valid Win32 application

However, i had no opencv binaries path that looked like (C:\\opencv\\build\\bin\\Release) so i added two paths, c:\\opencv\\build\\x64\\vc12\\bin and c:\\opency\\build\\vc11\\bin to my PATH environment variables. However, this has no effect either and i still get the error upon trying to import cv2. what could i be doing wrong?

Have you tried the wheel from http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv ? There is a 2.4.13 available, maybe that will fix things?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM