pip install opencv-python
复制代码
安装了opencv-python 以后,在使用 import cv2 报错以下python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda3/lib/python3.6/site-packages/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ImportError: libSM.so.6: cannot open shared object file: No such file or directory
>>>
复制代码
报错缘由: 缺乏共享库linux
Centos解决方案ide
yum whatprovides libSM.so.6
yum install libSM-1.2.2-2.el7.x86_64 --setopt=protected_multilib=false
复制代码
Ubuntu解决方案spa
sudo apt-get install libsm6
sudo apt-get install libxrender1
sudo apt-get install libxext-dev
复制代码