我使用Windows 32位的wmi库和Python获得CPU温度,但我认为与Core Temp的结果相比,这是错误的

2024-09-29 17:11:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用wmi库通过以下代码不断获得30.85°的值。这是我的密码:

import wmi

w = wmi.WMI(namespace=r'root\wmi')

temp = w.MSAcpi_ThermalZoneTemperature()[0].CurrentTemperature

kelvin = temp / 10
celsius = kelvin - 273.15
fahrenheit = (9/5) * celsius + 32

print(f'Kalvin:{kelvin:^10.2f}\tCelsius:{celsius:^10.2f}\tFahrenheit:{fahrenheit:^10.2f}')

结果如下:

Kalvin:  304.00     Celsius:  30.85     Fahrenheit:  87.53   

我还想指出,除非我重新启动笔记本电脑,或者等待大约30分钟,否则这个值不会改变

最后,以下是Core Temp 1.15.1中显示的不断变化的结果

Core Temp Results in the temperature of all cores

你能帮我翻译一下吗


Tags: 代码import密码rootwminamespacetempfahrenheit

热门问题