在docker虚拟机下安装了opencv以后,在使用的时候出现以下报错,
Traceback (most recent call last):
File "data_generator.py", line 24, in <module>
import cv2
File "/usr/local/lib/python3.5/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
Traceback (most recent call last):
File "Det_Classifier.py", line 5, in <module>
import cv2
File "/usr/local/lib/python3.5/dist-packages/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ImportError: libXrender.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "Det_Classifier.py", line 5, in <module>
import cv2
File "/usr/local/lib/python3.5/dist-packages/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ImportError: libXext.so.6: cannot open shared object file: No such file or directory
# Install
$ apt-get update
$ apt-get install apt-file
# Update apt-file
$ apt-file update
下载过程中会出现一次性下载失败的情况,多执行几次,或者改一下源的地址
$ apt-file search libSM.so.6
$apt-get install libsm6x
$apt-get install libxrender1
$apt-get install libxext-dev