python 安装opencv
安装opencv很简单,只需在命令窗口输入:
pip install opencv-python
然而在引用的时候遇到了报错:
import cv2
报错如下:
“ImportError: libSM.so.6: cannot open shared object file: No such file or directory”
解决的办法:
先确定自己的系统是ubantu系统还是Centos系统,如果是Ubantu,先输入:
sudo apt-get install libsm6
sudo apt-get install libxrender1
sudo apt-get install libxext-dev
是Centos系统,则输入:
yum whatprovides libSM.so.6
yum install libSM-1.2.2-2.el7.x86_64 --setopt=protected_multilib=false
我的系统是Ubantu系统,在小黑窗中输入上述的命令之后,报错得以解决!
本文详细介绍了在Ubuntu系统中安装OpenCV并解决“ImportError:libSM.so.6:cannot open shared object file: No such file or directory”错误的过程。通过安装libsm6、libxrender1和libxext-dev等依赖库,成功解决了OpenCV在Python环境下引用时报错的问题。
1593

被折叠的 条评论
为什么被折叠?



