pip install opencv-python
Copy the code
After installing Opencv-Python, the following error occurs when using import cv2
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): The File < stdin ">", line 1, the in the < module > File "/ root/anaconda3 / lib/python3.6 / site - packages/cv2 / set py", line 3, in <module> from .cv2 import * ImportError: libSM.so.6: cannot open shared object file: No such file or directory >>>Copy the code
The shared library is missing
Centos Solution
6 yum install libsm-1.2.2-2.el7.x86_64 --setopt=protected_multilib=falseCopy the code
Ubuntu Solution
sudo apt-get install libsm6
sudo apt-get install libxrender1
sudo apt-get install libxext-dev
Copy the code