Raspberry Pi - psutil install error

python, raspberry-pi

Solution

You need to install the Python development headers too. On Debian (Raspbian “wheezy”), install the `python-dev` package:

sudo apt-get install python-dev

or run:

sudo apt-get build-dep python

and get a few more packages that come in handy when compiling Python C extensions. Replace `python` with `python3` on more recent Debian releases.

On Fedora (Pidora) the equivalent of that last command is:

sudo yum install yum-utils
sudo yum-builddep python

Here too you may want to replace `python` with `python3` if your system is more recent.

Problem

I'm trying to install psutil on my raspberry pi and I cant seem to get to work. If I do pip install I get this error: ``` psutil/_psutil_linux.c:10:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 ---------------------------------------- Command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/psutil/setup.py';exec(compile(open(__file__).read().replace('\r\n ', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-V39ila-record/install-record.txt failed with error code 1 in /home/pi/build/psutil Storing complete log in /root/.pip/pip.log ``` If i try python setup.py build from the directory of the install file I get this error: ``` psutil/_psutil_linux.c:10:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 ``` if some one could help me get this installed that would be great.

Original source