How to install OpenCV in Python?

OpenCV is a Python library that is used to solve computer vision problems. Computer vision include understanding and analyzing digital images by the computer and process the images or provide relevant data after analyzing the image.

OpenCV is an open-source library used in machine learning and image processing. It performs tasks such as recognizing handwritten digits, human faces, and objects.

To use OpenCV, we need to install it.

Step 1 − Make sure Python and pip is preinstalled on your system

Type the following commands in command prompt to check is python and pip is installed on your system.

To check Python

python --version

If Python is successfully installed, the version of python installed on your system will be displayed.

To check pip

pip -V

The version of pip will be displayed, if it is successfully installed on your system.

Step 2 − Install OpenCV

OpenCV can be installed using pip. The following command is run in the command prompt to install OpenCV.

pip install opencv-python

This command will start downloading and installing packages related to the OpenCV library. Once done, the message of successful installation will be displayed.

Updated on: 26-Aug-2023

27K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started