Linux
Ubuntu / Debian:
sudo apt-get install gcc python-dev python-pip
sudo pip install psutil
RedHat / CentOS:
sudo yum install gcc python-devel python-pip
sudo pip install psutil
If you're on Python 3 use python3-dev
and python3-pip
instead.
Windows
The easiest way to install psutil on Windows is to just use the pre-compiled exe/wheel installers hosted on PYPI via pip:
C:\Python27\python.exe -m pip install psutil
If you want to compile psutil from sources you'll need Visual Studio (Mingw32 is no longer supported), which really is a mess. The VS versions are the onle listed below. This blog post provides numerous info on how to properly set up VS (good luck with that).
Compiling 64 bit versions of Python 2.6 and 2.7 with VS 2008 requires Windows SDK and .NET Framework 3.5 SP1. Once installed run vcvars64.bat, then you can finally compile (see here). To compile / install psutil from sources on Windows run:
make.bat build
make.bat install