ImportError: libSM.so.6: cannot open shared object file: No such file or directory

​>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-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

You have missed some package dependencies in your Ubuntu 18.04 machine, install the following commands,
 
$ sudo apt-get update

$ sudo apt-get install -y libsm6 libxext6 libxrender-dev

$ sudo pip3 install opencv-python