无法在python2中导入sos包

3zwjbxry  于 2021-09-29  发布在  Java
关注(0)|答案(1)|浏览(374)

我试图在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中,这是正常的。

8xiog9wr

8xiog9wr1#

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

[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
>>>

相关问题