Python Raspberry Pi-psutil安装错误

Python Raspberry Pi-psutil安装错误,python,raspberry-pi,Python,Raspberry Pi,我正在尝试将psutil安装到我的raspberry pi上,但我似乎无法开始工作。如果执行pip安装,则会出现以下错误: 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 -----------------------------------

我正在尝试将psutil安装到我的raspberry pi上,但我似乎无法开始工作。如果执行pip安装,则会出现以下错误:

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
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
如果从安装文件的目录中尝试python setup.py build,则会出现以下错误:

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

如果有人能帮我安装这个,那就太好了。

您还需要安装Python开发标题。在Debian(Raspbian“wheezy”)上,安装
python dev
包:

sudo apt-get install python-dev
或运行:

sudo apt-get build-dep python
并获得更多在编译PythonC扩展时派上用场的包

在Fedora(Pidora)上,最后一个命令的等价物是:

sudo yum install yum-utils
sudo yum-builddep python

对于
sudo apt get build dep python
,您需要确保在源代码列表中有一些源URI。否则,回答得很好。我也是从树莓皮上的麻烦中来的。这很好地解决了我在那里的问题。