运行glances时报如下错误:
/usr/lib/python3/dist-packages/psutil/_pslinux.py:1150: RuntimeWarning: ignoring OSError(61, '没有可用的数据')
warnings.warn("ignoring %r" % err, RuntimeWarning)
报此错误时运行如下命令也报错
$ python3
> import psutil
> psutil.sensors_temperatures()
> psutil.sensors_fans()
> psutil.sensors_battery()
运行结果如下
Python 3.6.9 (default, Jun 29 2022, 11:45:57)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.sensors_temperatures()
/usr/lib/python3/dist-packages/psutil/_pslinux.py:1150: RuntimeWarning: ignoring OSError(61, 'No data available')
warnings.warn("ignoring %r" % err, RuntimeWarning)
{'acpitz': [shwtemp(label='', current=16.8, high=20.8, critical=20.8), shwtemp(label='', current=16.8, high=20.8, critical=20.8), shwtemp(label='', current=27.8, high=119.0, critical=119.0)], 'pch_cometlake': [shwtemp(label='', current=30.0, high=None, critical=None)], 'coretemp': [shwtemp(label='Package id 0', current=25.0, high=82.0, critical=100.0), shwtemp(label='Core 8', current=24.0, high=82.0, critical=100.0), shwtemp(label='Core 9', current=23.0, high=82.0, critical=100.0), shwtemp(label='Core 0', current=22.0, high=82.0, critical=100.0), shwtemp(label='Core 1', current=24.0, high=82.0, critical=100.0), shwtemp(label='Core 2', current=23.0, high=82.0, critical=100.0), shwtemp(label='Core 3', current=23.0, high=82.0, critical=100.0), shwtemp(label='Core 4', current=22.0, high=82.0, critical=100.0), shwtemp(label='Core 5', current=22.0, high=82.0, critical=100.0), shwtemp(label='Core 6', current=22.0, high=82.0, critical=100.0), shwtemp(label='Core 7', current=24.0, high=82.0, critical=100.0)], 'nouveau': [shwtemp(label='', current=35.0, high=95.0, critical=105.0)]}
>>> psutil.sensors_fans()
{'nouveau': [sfan(label='', current=2294)]}
>>> psutil.sensors_battery()
>>> exit()
请执行命令更新:
sudo pip3 install --upgrade psutil
问题解决。
参考官方bug问题列表:
Glances is not showing sensors information. · Issue #1087 · nicolargo/glances · GitHub