【发布时间】:2021-10-03 05:58:05
【问题描述】:
我正在尝试在rhel8.3中导入python2中的sos包,但出现以下错误
[root@svr_1 site-packages]# python2.7
Python 2.7.17 (default, Aug 18 2020, 09:42:29)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sos
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named sos
软件包的 rpm 已经安装。
[root@svr_1 site-packages]# yum list installed | grep sos
sos.noarch 3.9.1-6.el8 @InstallMedia
[root@svr_1 site-packages]#
有没有人知道。在 rhel7 中这没问题。
【问题讨论】:
-
如前所述rpmfind.net/linux/rpm2html/search.php?query=sossos.noarch 是一组工具,而不是 python 模块/包。可以搜索
python2-sos吗? -
在 rhel7
[root@svr_1 ~]# python2 Python 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sos >>> -
据我所知,你有多个版本的 python2,当你安装 sos 时,你会得到另一个版本的 python。最好是为你的python2.7安装pip pip.pypa.io/en/stable/installation 然后就可以安装sos
python2.7 -m pip install sos