OpenCV (Open Source Computer Vision) is a cross-platform Python library commonly used in computer vision tasks such as Deep Learning, Image processing, Augmented Reality, Object Detection, etc. You have to install it first as it doesn’t come pre-built in Python.

This blog post will present a step-by-step procedure to install OpenCV using pip in Python.

How to Install OpenCV in Python?

To install OpenCV, you have to install Anaconda first. Simply go to Anaconda’s website and click on the Download Button as shown below:

It’s a big package so hold your patience, the downloading will take some time. I have already installed it so let’s move to the next step.

Open the Windows Search Box and look for Anaconda Prompt as shown below:

Use the following command to install OpenCV in Python:

$ pip install open-cv python

To check if it’s installed or not, go to jupyter notebook and check for its version as shown below:

How To Install OpenCV on VSCode?

To install OpenCV on VSCode, open the VSCode Editor and click on the terminal in the bottom left corner. Now change the terminal from PowerShell to Command Prompt as shown below:

Now we need to create a virtual environment. Use the following command to create a virtual environment:

$ python -m venv environmentname

In my case, the environment name is opencv as shown below:

A new environment folder is created as shown below:

Now we will activate the environment using the following command:

$ environmentname\Scripts\activate

Now use the following command to install OpenCV.

$ pip install open-cv Python

It can be seen that the openCV is installed successfully.


We can install OpenCV on Python using different methods. First, you have to install Anaconda, now go to the Anaconda prompt, and execute the conda install open-cv python command to install OpenCV. Alternatively, open the VSCode and create a virtual environment. Now activate the environment using python\Scripts\environmentname. Finally, use the pip install open-cv python command to install OpenCV.