Skip to content

Latest commit

 

History

History
155 lines (100 loc) · 3.51 KB

INSTALL.rst

File metadata and controls

155 lines (100 loc) · 3.51 KB

PIP

pip is the easiest way to install psutil. It is shipped by default with Python 2.7.9+ and 3.4+. If you're using an older Python version install pip first. If you GIT cloned psutil source code you can also install pip and/or upgrade it to latest version with:

make install-pip

Unless you're on Windows, in order to install psutil with pip you'll also need a C compiler installed (e.g. gcc). pip will retrieve psutil source code or binaries from PYPI repository.

Permission issues (UNIX)

The commands below assume you're running as root. If you're not or you bump into permission errors you can either:

  • prepend sudo, e.g.:
sudo pip install psutil
  • install psutil for your user only (not at system level):
pip install --user psutil

Linux

Ubuntu / Debian:

sudo apt-get install gcc python-dev python-pip
pip install psutil

RedHat / CentOS:

sudo yum install gcc python-devel python-pip
pip install psutil

If you're on Python 3 use python3-dev and python3-pip instead.

Major Linux distros also provide binary distributions of psutil so, for instance, on Ubuntu and Debian you can also do:

sudo apt-get install python-psutil

On RedHat and CentOS:

sudo yum install python-psutil

This is not recommended though as Linux distros usually ship older psutil versions.

OSX

Install Xcode first, then:

pip install psutil

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):

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

FreeBSD

pkg install python gcc
python -m pip install psutil

OpenBSD

export PKG_PATH="http://ftp.openbsd.org/pub/OpenBSD/`uname -r`/packages/`arch -s`/"
pkg_add -v python gcc
python -m pip install psutil

NetBSD

export PKG_PATH="ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All"
pkg_add -v pkgin
pkgin install python gcc
python -m pip install psutil

Solaris

If cc compiler is not installed create a symlink to gcc:

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

Install:

pkg install gcc
python -m pip install psutil

Install from sources

git clone https://github.com/giampaolo/psutil.git
cd psutil
python setup.py install

Dev Guide

If you plan on hacking on psutil you may want to take a look at the dev guide.