$ pip install opencv-python
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement opencv-python (from versions: none)
ERROR: No matching distribution found for opencv-python
安装失败提示到不到。
上 https://pypi.org/ 查找,得到的是结果这个是非官方的源,是爱好者个人维护,所以pip 没有自动下载源码,因为上面没提供源码。源码在作者的github 里面。操作如下图:
2. 下载源码
$ git clone --depth 1 https://github.com/skvark/opencv-python.git
$ cat .gitmodules
[submodule "opencv"]
path = opencv
url = https://gitee.com/mirrors/opencv.git
[submodule "opencv_contrib"]
path = opencv_contrib
url = https://gitee.com/mirrors/opencv_contrib.git
[submodule "multibuild"]
path = multibuild
url = https://gitee.com/useptonly/multibuild.git
$ sudo apt install qt4-dev-tools qt4-qmake
$ sudo apt install cmake
$ sudo apt install python3-numpy
$ pip install scikit-build
编译
$ python3 setup.py bdist_wheel
编译好的文件:
./dist/opencv_python-4.3.0+3073e9e-cp37-cp37m-linux_mips64.whl
参考
[1] https://stackoverflow.com/questions/10315021/installing-opencv-for-python3
[2] https://stackoverflow.com/questions/20953273/install-opencv-for-python-3-3/21212023#21212023