ImportError: libSM.so.6: cannot open shared object file: No such file or directory
·
1 现象:
尝试导入OpenCV时,使用导入cv2出现以下错误:
/usr/local/lib/python2.7/dist-packages/cv2/__init__.py in <module>()
7
8 # make IDE's (PyCharm) autocompletion happy
----> 9 from .cv2 import *
10
11 # wildcard import above does not import "private" variables like __version__
ImportError: libSM.so.6: cannot open shared object file: No such file or directory
Not sure how to fix this - trying to play around with Google's new Colaboratory tool. Notebook is here: https://drive.google.com/file/d/0B7-sJqBiyjCcRmFkMzl6cy1iN0k/view?usp=sharing
2原因
centos服务器 没有图形工具 gui (非个人的ubantu)
3 解决
由于网络上都是 使用yum去安装libsm6 之类的包。但是公司服务器没有网络,只能另外想办法:
解决办法是安装有一个headless版本的opencv-python!~
它删除了图形依赖性(如libSM)。
您可以在releases page上看到normal / headless版(以及导致该问题的GitHub问题);
只需在安装时添加-headless,例如:
pip install opencv-python-headless
# also contrib, if needed
pip install opencv-contrib-python-headless
参考:https://stackoverflow.com/questions/47113029/importerror-libsm-so-6-cannot-open-shared-object-file-no-such-file-or-directo
更多推荐
所有评论(0)