Reputation: 1824
when I try to install OpenCV in RAspberry Pi 3 B+, it gives me following error:
$pip install opencv-python
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement opencv-python (from versions:
none)
ERROR: No matching distribution found for opencv-python
I have tried other ways also:
pip install opencv-contrib-python
pip3 install opencv-python
python3.6 -m pip install opencv-python
All give the same above error!
I tried few other ways:
sudo apt install python3-opencv
sudo apt-get install libopencv-dev python-opencv
Still cant import cv2
ModuleNotFoundError: No module named 'cv2'
I tried menpo channel
conda install -c menpo opencv
PackagesNotFoundError: The following packages are not available from current channels:
Please help. What to do now?
Upvotes: 2
Views: 4144
Reputation: 1824
OpenCv currently works on Raspbian 9-Stretch. Update os system:
sudo apt-get update
sudo apt-get upgrade
2) Install dependencies:
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk2.0-dev libgtk-3-dev
sudo apt-get install libatlas-base-dev gfortran
3) Install Python 3 and Pip3:
sudo apt-get install python3-dev
sudo apt-get install python3-pip
4) Install Opencv:
pip3 install opencv-python
5) Extra depencies for Opencv and the Camera:
sudo apt-get install libqtgui4
sudo modprobe bcm2835-v4l2
sudo apt-get install libqt4-test
Voila! OpenCv2 is installed.
Upvotes: 2