![](/img/trans.png)
[英]How can I get CPU temperature in Python? Assuming that I have Windows 32-bits
[英]I am getting CPU temperature using wmi library in Windows 32-bit with Python but I think it's false when compared with the results of Core Temp
我使用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 中显示的结果,这些结果不断变化。
你能帮我解释一下吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.