将 Python 升级到 3.10 后系统信息损坏

将 Python 升级到 3.10 后系统信息损坏

我正在运行 Ubuntu 20.04 LTS。当您使用 Putty 登录时,它通常会显示您的系统信息,如本示例所示

System information as of Mon May 30 06:16:35 UTC 2022

  System load:  0.55              Processes:           96
  Usage of /:   8.1% of 68.74GB   Users logged in:     0
  Memory usage: 55%               IP address for eth0: 198.xx.xxx.xxx
  Swap usage:   0%    

但是当我将python升级到3.10时,登录时不再显示系统信息。我尝试手动运行,landscape-sysinfo但出现错误:

Traceback (most recent call last):
  File "/usr/bin/landscape-sysinfo", line 22, in <module>
    run(sys.argv[1:], reactor)
  File "/usr/lib/python3/dist-packages/landscape/sysinfo/deployment.py", line 115, in run
    for plugin in config.get_plugins():
  File "/usr/lib/python3/dist-packages/landscape/sysinfo/deployment.py", line 69, in get_plugins
    return [namedClass("landscape.sysinfo.%s.%s"
  File "/usr/lib/python3/dist-packages/landscape/sysinfo/deployment.py", line 69, in <listcomp>
    return [namedClass("landscape.sysinfo.%s.%s"
  File "/usr/lib/python3/dist-packages/twisted/python/reflect.py", line 173, in namedObject
    module = namedModule('.'.join(classSplit[:-1]))
  File "/usr/lib/python3/dist-packages/twisted/python/reflect.py", line 159, in namedModule
    topLevel = __import__(name)
  File "/usr/lib/python3/dist-packages/landscape/sysinfo/network.py", line 4, in <module>
    from netifaces import AF_INET, AF_INET6
ModuleNotFoundError: No module named 'netifaces'

所以我尝试重新安装 netifaces,但它说它已经安装了最新版本。有什么解决办法吗?我想在使用 putty 登录时再次显示系统信息

相关内容