小编Geo*_*azu的帖子

Python - 获取传感器值和风扇速度 - Windows 10

我一直在尝试使用Python脚本来显示我的硬件中的CPU,GPU和其他可用传感器的温度,但我没有找到任何有用的东西.

我尝试使用WMI来获取这些值,但我的处理器显然不受支持.

我使用的代码是:

import wmi
w = wmi.WMI(namespace="root\wmi")
temperature_info = w.MSAcpi_ThermalZoneTemperature()[0]
print temperature_info.CurrentTemperature
Run Code Online (Sandbox Code Playgroud)

我从另一个stackoverflow线程获得,我得到错误Traceback(最近一次调用最后):

  File "C:/Users/Joe/Desktop/test.py", line 3, in <module>
    temperature_info = w.MSAcpi_ThermalZoneTemperature()[0]
  File "C:\Python27\lib\site-packages\wmi.py", line 819, in query
    handle_com_error ()
  File "C:\Python27\lib\site-packages\wmi.py", line 241, in handle_com_error
    raise klass (com_error=err)
x_wmi: <x_wmi: Unexpected COM Error (-2147217396, 'OLE error 0x8004100c', None, None)>
Run Code Online (Sandbox Code Playgroud)

根据Microsoft支持,这意味着Not Supported (0x8004100C) 我已经尝试在cmd.exe窗口中运行此代码的命令行版本作为管理员运行,但我得到了同样的错误.

有没有其他方法可以访问CPU和GPU温度?

PS:我的操作系统是Windows 10,我的CPU是AMD FX-8350.我不确定我的操作系统或我的CPU是否有错误.

python windows cpu wmi temperature

9
推荐指数
1
解决办法
845
查看次数

标签 统计

cpu ×1

python ×1

temperature ×1

windows ×1

wmi ×1