0

我正在尝试在 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 中,这没问题。

4

1 回答 1

0

对于任何面临同样问题的人。rhel8 的默认 python 是 python 3。因此,安装 rhel8 包时,python 包将位于 /usr/lib/python3.6/site-packages 下,并且可以从 python 3 使用。

 [root@svr_1 plugins]# python3
Python 3.6.8 (default, Aug 18 2020, 08:33:21)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sos
>>>
于 2021-07-27T13:02:12.070 回答