Environment: Windows 7 + Python 2.7 + OpenCV 2.4.5
First, OpenCV
1) Download the OPENCV installation package for Windows. OpenCV download page: http://sourceforge.net/projects/opencvlibrary/files/opencv-win/
2) Direct Download opencv-2.4.5.exe (278.9 MB)
Installation. You'll find that it's actually the decompression process.
Second, Python
1) Download the Python installation package for Windows. Python download page: http://www.python.org/getit/
Download Python 2.7.5 Windows Installer directly
2) installation.
3) Expand Python's third-party library--OPENCV Python Library
Enter the installation directory of the OpenCV to find: \build\python\2.7\cv2.pyd
Copy the Cv2.pyd to the subdirectory of Python: \lib\site-packages\
Put the OpenCV directory "D:\Program files\opencv\build\python\2.7" under "Cv2.pyd"
Copy to the Python directory ". \program Files\python27\lib\site-packages", then;
OK, so the environment is set up.
Third, test the sample program
OpenCV comes with many sample programs and goes to subdirectories under the OPENCV installation directory: \samples\python2\, you can see a lot of files with a. py suffix;
Open a. py file with Python, press the F5 key to run, see the effect
Import Cv2
"Python" + "OpenCV" Environment configuration