Alex Rivera | Logout

Getting CPU temperature using Python?

Asked 2010-03-13T23:35:19.730
32

How do I retrieve the temperature of my CPU using Python? (Assuming I'm on Linux)

Edit
Report

2 Answers

24

There is a newer "sysfs thermal zone" API (see also LWN article and Linux kernel doc) showing temperatures under e.g.

/sys/class/thermal/thermal_zone0/temp

Readings are in thousandths of degrees Celcius (although in older kernels, it may have just been degrees C).

answered 2013-03-04T23:40:35.613
3

Depending on your Linux distro, you may find a file under /proc that contains this information. For example, this page suggests /proc/acpi/thermal_zone/THM/temperature.

answered 2010-03-13T23:41:20.607

Your Answer