I stumbled on this same issue. Here's what I did:
- Unpack the OpenCV distribution into a folder, for example:
C:\RPS\python\epd32
- Open a text editor and create a one line file that contains the full path where you installed OpenCV + the subdirectory where the python binding lives, for example:
C:\RPS\python\epd32\opencv\build\python\2.7
.
Save this .pth
file in your Enthought Canopy user site packages folder, for example: C:\Users\rsignell\AppData\Local\Enthought\Canopy32\User\Lib\site-packages\opencv.pth
Open Enthought Canopy and try typing import cv2
. It should now work!
I do it this way because I like having the whole OpenCV distro on my system, with the examples and other stuff.
But if you don't want the whole OpenCV distro hanging around, you could also just copy <opencv>\build\python\2.7\cv2.pyd
into your site-packages
directory and then delete the directory that OpenCV unpacked everything into.
Or to avoid extracting everything, you could open the opencv.exe using with something like 7-zip (open inside) and extract just <opencv>\build\python\2.7\cv2.pyd
into your site-packages
directory.