Install opencv-python (which is the official pre-built OpenCV package for Python) by issuing the following command:
pip install opencv-python
Answer from Eiconic on Stack Overflow
ยป pip install opencv-python
Install opencv-python (which is the official pre-built OpenCV package for Python) by issuing the following command:
pip install opencv-python
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"
Videos
For Python 3 you can simply do pip3 install opencv-python and it will work.
Using workon, creating a virtual environment:
mkvirtualenv -p python3 opencv
Inside the virtual environment. If you are only working with images
pip install opencv-python
opencv-python
If you need support for working videos:
pip install opencv-contrib-python
opencv-contrib-python
If you need a non-GUI OpenCV:
pip install opencv-python-headless
opencv-python-headless
If you need to install specific version you can use == to check the available version first like
pip install opencv-python==, then install the version you require