[英]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.