1) 先安装pip3
sudo apt install python3-pip
2) 避免RuntimeError: Running cythonize failed!
ModuleNotFoundError: No module named 'Cython'
需要安装 cython:
pip3 install cython
3) 避免ModuleNotFoundError: No module named 'skbuild'
需要安装scikit-build :
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple scikit-build
4) 避免 Problem with the CMake installation, aborting build. CMake executable is cmake
需要安装pip
pip3 install pip -U
pip3 install cmake
5) 正式安装opencv-python:
pip3 install opencv-python
6) OPENBLAS_CORETYPE=ARMV8 python3
如果不执行OPENBLAS_CORETYPE=ARMV8 ,执行import cv2会异常终止
错误如下: Illegal instruction (core dumped)
运行 python3
OPENBLAS_CORETYPE=ARMV8 python3
保存一张图片
- import cv2
-
- cap = cv2.VideoCapture(0)
-
- ret, frame = cap.read()
-
- cv2.imwrite("./fangjian2.jpeg", frame)
-
- cap.release()
-