Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install opencv using pip?

Tags:

python

opencv

I need to install cv2 for a script that has been written for me. I tried pip install cv2 and pip install open_cv and got the same problem - a warning message from dist.py and complains about zlib being not found. No cv2 installed. I also tried pyopenvc and pip install opencv-python.

So, I went to the opencv site and downloaded the relevant exe. Ran it - generated a heap of subdirectories and a make file and stuff.

What do I do now?

like image 623
Ian Boag Avatar asked Sep 26 '22 21:09

Ian Boag


Video Answer


2 Answers

Install opencv-python (which is an unofficial pre-built OpenCV package for Python) by issuing the following command:

pip install opencv-python
like image 269
Eiconic Avatar answered Oct 10 '22 03:10

Eiconic


run the following command by creating a virtual enviroment using python 3 and run

pip3 install opencv-python

to check it has installed correctly run

python3 -c "import cv2"
like image 61
HamzaMushtaq Avatar answered Oct 10 '22 04:10

HamzaMushtaq