Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
...also refactor it a bit and add install instructions for Alpine Linux

Signed-off-by: Giampaolo Rodola <>
4 contributors

Users who have contributed to this file

@giampaolo @jdufresne @mnxoid @kianmeng

Install psutil

Linux, Windows, macOS (wheels)

Pre-compiled wheels are distributed for these platforms, so you won't have to install a C compiler. All you have to do is:

pip install psutil

If wheels are not available for your platform or architecture, or you wish to build & install psutil from sources, keep reading.

Linux (build)

Ubuntu / Debian:

sudo apt-get install gcc python3-dev
pip install --no-binary :all: psutil

RedHat / CentOS:

sudo yum install gcc python3-devel
pip install --no-binary :all: psutil


sudo apk add gcc python3-dev
pip install --no-binary :all: psutil

Windows (build)

In order to install psutil from sources on Windows you need Visual Studio (MinGW is not supported). Here's a couple of guides describing how to do it: link and link. Once VS is installed do:

pip install --no-binary :all: psutil

macOS (build)

Install Xcode then run:

pip install --no-binary :all: psutil


pkg install python3 gcc
python3 -m pip install psutil


export PKG_PATH=`uname -r`/packages/`uname -m`/
pkg_add -v python gcc
pip install psutil


export PKG_PATH="`uname -m`/`uname -r`/All"
pkg_add -v pkgin
pkgin install python3 gcc
pip install psutil

Sun Solaris

If cc compiler is not installed create a symbolic link to gcc:

sudo ln -s /usr/bin/gcc /usr/local/bin/cc


pkg install gcc
pip install psutil


Install pip

Pip is shipped by default with Python 2.7.9+ and 3.4+. If you don't have pip you can install with wget:

wget -O - | python3

...or with curl:

python3 < <(curl -s

On Windows, download pip, open cmd.exe and install it with:


"pip not found"

Sometimes pip is installed but it's not available in your PATH ("pip command not found" or similar). Try this:

python3 -m pip install psutil

Permission errors (UNIX)

If you want to install psutil system-wide and you bump into permission errors either run as root user or prepend sudo:

sudo pip install psutil