Before installing OpenCV in Python, you need to install the following packages in the default locations:
- Python 2.7.x
- NumPy
- Matplotlib
After successfully installing the above packages, now, you have to download the latest version of OpenCV from this link.
After downloading OpenCV, now, you can install it in your system. For that, click on the .exe file, and it will extract all the files into your system.
Now, you just need to browse to the opencv/build/Python/2.7 folder and simply copy the syntax cv2.pyd and paste it to C:/Python27/lib/site-packages.
Finally, for checking if OpenCV is installed properly, you can go to Python IDLE and execute the following codes in the Python terminal:
>>> import cv2
>>> print cv2.__version__
If you're not getting any errors, then it means that you have successfully installed OpenCV.
If you are looking for an online course to learn Python, I recommend this Python Training program by Intellipaat.