How to know the temperature of the processor? What are the libraries?

    3 answers 3

    Take advantage of this . In general, Google is full of answers.

    from pyspectator.processor import Cpu from time import sleep cpu = Cpu(monitoring_latency=1) with cpu: for _ in range(8): cpu.load, cpu.temperature sleep(1.1) 
    • thank! I installed the pyspectator module, but it requires the win32com module, which is not installed through pip, what advice do you have? - Alexander
    • pip install pywin32-220.1-cp27-cp27m-win32.whl For version 2.7, if not your version, change 27 to the one you need. And also the capacity of the system - Pavel Durmanov
    • Installed ....) now win32com requires win32api, it is also not installed via pip ... what to do? - Alexander
    • I have a python 3.5.2 - Alexander
    • everything should be in pywin. Try installing sourceforge.net/projects/pywin32/files/pywin32/Build%20220 from here - Pavel Durmanov

    There is a good library , you can install via pip.

    Code example:

     from pyspectator import Cpu from time import sleep cpu = Cpu(monitoring_latency=1) while True: print cpu.temperature sleep(1) 

      On Linux, there is psutil.sensors_temperatures() :

       >>> import psutil >>> psutil.sensors_temperatures() {'acpitz': [shwtemp(label='', current=47.0, high=103.0, critical=103.0)], 'asus': [shwtemp(label='', current=47.0, high=None, critical=None)], 'coretemp': [shwtemp(label='Physical id 0', current=52.0, high=100.0, critical=100.0), shwtemp(label='Core 0', current=45.0, high=100.0, critical=100.0), shwtemp(label='Core 1', current=52.0, high=100.0, critical=100.0), shwtemp(label='Core 2', current=45.0, high=100.0, critical=100.0), shwtemp(label='Core 3', current=47.0, high=100.0, critical=100.0)]} 

      You can compare the values ​​returned by the sensors_temperatures() with what psensor shows .

      psutil widely used .

      • I did not know about it. As always on top) - Pavel Durmanov