在CentOS中安装了opencv-python 之后,在使用 import cv2 时报错和相应的解决方法(在CentOS中没有apt-get时,可以使用如下方法)。
错误1:
ImportError: libSM.so.6: cannot open shared object file: No such file or directory
解决方法:
- 提示需要的安装包
yum whatprovides libSM.so.6
- 根据提示的包进行安装,如上图中第三行的libSM-1.2.2-2.el7.x86_64
yum install libSM-1.2.2-2.el7.x86_64 --setopt=protected_multilib=false
错误2:
ImportError: libXrender.so.1: cannot open shared object file: No such file or directory
解决方法:
- 提示需要的安装包
yum whatprovides libXrender.so.1
- 根据提示的包进行安装,如上图中第三行的libXrender-0.9.10-1.el7.x86_64
yum install libXrender-0.9.10-1.el7.x86_64 --setopt=protected_multilib=false
错误3:
ImportError: libXext.so.6: cannot open shared object file: No such file or directory
解决方法:
- 提示需要的安装包
yum whatprovides libXext.so.6
- 根据提示的包进行安装,如上图中第三行的libXext-1.3.3-3.el7.x86_64
yum install libXext-1.3.3-3.el7.x86_64 --setopt=protected_multilib=false