惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog
IT之家
IT之家
博客园 - 聂微东
The Cloudflare Blog
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
H
Help Net Security
博客园 - 叶小钗
V
V2EX
WordPress大学
WordPress大学
J
Java Code Geeks
Hugging Face - Blog
Hugging Face - Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园_首页
C
Check Point Blog
B
Blog
D
DataBreaches.Net
美团技术团队
罗磊的独立博客

博客园 - CalvinChu

vyos syslog配置 How to upgrade pip on Debian Wheezy 指数数据解密,懂的都懂 OpenWRT and VPN Passthrough - CalvinChu 如何将 find 命令与 exec 一起使用 CentOS 7 下搭建 OpenVPN - CalvinChu How to get the ip ranges of domain esxi 直通sata控制器 Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_P xRDP – Detected issues with Debian 11 – Oh No ! Something has gone wrong…. qemu-mips环境搭建跳坑指南 openwrt(lede)中,PPtP Client需要安装的软件包 OpenWrt中的Hotplug脚本 MAC OSX VPN自动添加静态路由 - CalvinChu fbprophet安装和使用 CentOS7安装iptables防火墙 CENTOS7下安装REDIS mysql忘记root密码解决办法 iptables命令(备忘)
ImportError: libSM.so.6: cannot open shared object file: ...
CalvinChu · 2021-04-08 · via 博客园 - CalvinChu

在centos中使用opencv-python。在进行导入的时候报出如下错误

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

主要原因时系统缺少libSM.so.6库文件。
可以使用如下命令查找包含此库的文件

yum whatprovides libSM.so.6


显示如下

Loaded plugins: fastestmirror, ovl
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Determining fastest mirrors
* base: mirrors.bfsu.edu.cn
* epel: repo.ugm.ac.id
* extras: mirrors.bfsu.edu.cn
* updates: mirror.bit.edu.cn
libSM-1.2.2-2.el7.i686 : X.Org X11 SM runtime library
Repo : base
Matched from:
Provides : libSM.so.6

说明只要安装libSM-1.2.2-2.el7.i686文件就行
如果系统时64位需要把i686改成x86_64
如下

yum install libSM-1.2.2-2.el7.x86_64 --setopt=protected_multilib=false

如果缺少其他库一样方法安装就行。