在 Raspberry pi 3 中安装 openCV 失败

Install openCV in Raspberry pi 3 fails

当我尝试在 RAspberry Pi 3 B+ 中安装 OpenCV 时,出现以下错误:

$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

我也试过其他方法:

pip install opencv-contrib-python
pip3 install opencv-python
python3.6 -m pip install opencv-python

都报同样的上述错误!

我尝试了其他几种方法:

sudo apt install python3-opencv
sudo apt-get install libopencv-dev python-opencv

仍然无法导入 cv2

ModuleNotFoundError: No module named 'cv2'

我试过menpo频道

conda install -c menpo opencv
PackagesNotFoundError: The following packages are not available from current channels:

请帮忙。现在怎么办?

OpenCv 目前在 Raspbian 9-Stretch 上工作。 更新 os 系统:

sudo apt-get update
sudo apt-get upgrade

2) 安装依赖项:

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) 安装Python3和Pip3:

sudo apt-get install python3-dev
sudo apt-get install python3-pip

4) 安装Opencv:

pip3 install opencv-python

5) Opencv 和相机的额外依赖项:

sudo apt-get install libqtgui4
sudo modprobe bcm2835-v4l2
sudo apt-get install libqt4-test

瞧!已安装 OpenCv2。