前言
我在使用pip install opencv-python 時報錯
Could not find a version that satisfies the requirement opencv (from versions: ) No matching distribution found for opencv
樹莓派的鏡像是默認裝的鏡像,沒怎么裝過其他東西的。我查看了python的版本,python是2.7版本的,樹莓派鏡像默認是裝好了python2。分析原因,python2版本過久,無法找到滿足opencv需求的版本。然后我將python3后安裝,發現opencv安裝成功。
具體操作
1.執行 sudo apt-get install python3 命令安裝python3
sudo apt-get install python3
2.執行 python3 -V 查看 python3是否安裝成功
python3 -V
3.執行 pip3 install opencv-python
pip3 install opencv-python
安裝好后如圖

4.執行 pip3 list 驗證 pip3中是否安裝了opencv-python
pip3 list

5.進入python3 執行 import cv2 as cv 查看opencv-python 是否成功安裝進python3
python3 import cv2 as cv

此時出現了個坑,報錯:ImportError:libcblas.so.3:cannot open shared object file:No such file or directory
這個報錯的意思是沒有安裝libcblas的庫,此時安裝Blas 的依賴項就解決了。安裝libcblas庫的命令是:
sudo apt-get install libatlas-base-dev
或
sudo apt-get install libgflags-dev sudo apt-get install libgoodle-glog-dev sudo apt-get install liblmdb-dev sudo apt-get install python sudo apt-get install python-dev sudo apt-get install python-numpy sudo apt-get install ipython sudo apt-get install ipython-notebook sudo apt-get install python-sklearn sudo apt-get install python-skimage sudo apt-get install python-protobuf
這里演示 命令 sudo apt-get install libatlas-base-dev

6.再次進入python3 執行 import cv2 as cv 查看opencv-python 是否成功安裝進python3
(若第五步遇到坑則執行第六步)
