How to use psutil module on windows?

Viewed 1976

I am trying to get cpu temperature using psutil module. I installed it using

pip install psutil

It installed perfectly fine. However, when I try to import it I get the following error.

Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import psutil
File "C:\Users\Awais\AppData\Roaming\Python\Python37\site-packages\psutil\__init__.py", line 147, 
in <module>
from . import _pswindows as _psplatform
File "C:\Users\Awais\AppData\Roaming\Python\Python37\site-packages\psutil\_pswindows.py", line 35, in 
<module>
from ._psutil_windows import ABOVE_NORMAL_PRIORITY_CLASS
ModuleNotFoundError: No module named 'psutil._psutil_windows'
1 Answers

I solved a similar problem by downgrading my psutil from version 5.7.0 to 4.1.0 using the following command:

pip install psutil==4.1.0

I'm not sure what the actual reason for this error is. Perhaps an incompatibility with your python version? In my case, I was using Python 3.5.4.

Related