安装opencv库成功后import cv2报错

报错找不到 libSM.so.6 libXrender.so.1 libXext.so.6
首先apt-get update
出错的话一一排查
①证书错误的话:Certificate verification failed: The certificate is NOT trusted
将/etc/apt/sources.list中的网址的https改成http
②GPG error: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC
The repository ‘https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 InRelease’ is not signed.
解决方法:

RUN rm /etc/apt/sources.list.d/cuda.list
RUN rm /etc/apt/sources.list.d/nvidia-ml.list

这两个错误解决后apt-get install应该是可以成功的

③apt 更新后执行下面几条语句

apt-get install libsm6
apt-get install libxrender1
apt-get install libxext-dev

④接着pip install opencv-python
(之前安了也再执行一遍)

还报错试试
apt-get update && apt-get install ffmpeg libsm6 libxext6 -y

猜你喜欢

转载自blog.csdn.net/qq_43666068/article/details/132153252