检查 OpenCV 版本,可能是 OpenCV 版本问题或某些不兼容:
python3 -c "import cv2; print(cv2.__version__)"
解决方法: 回退到4.5.5.64版本
pip3 install --upgrade opencv-python opencv-python-headless --index-url https://mirrors.aliyun.com/pypi/simple/
pip3 install opencv-python==4.5.5.64 --index-url https://mirrors.aliyun.com/pypi/simple/
新的报错:ImportError: libGL.so.1: cannot open shared object file: No such file or directory
缺少 OpenCV 依赖的库文件 libGL.so.1:
pip3 install opencv-python-headless==4.5.5.64 --index-url https://mirrors.aliyun.com/pypi/simple/
Done.