Raspberry Pi - psutil安装错误

ras*_*.pi 8 python raspberry-pi

我正在尝试在我的覆盆子pi上安装psutil,我似乎无法开始工作.如果我做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
Run Code Online (Sandbox Code Playgroud)

如果我从安装文件的目录尝试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
Run Code Online (Sandbox Code Playgroud)

如果有人可以帮助我安装这将是伟大的.

Mar*_*ers 25

您还需要安装Python开发头文件.在Debian(Raspbian"wheezy")上,安装python-dev包:

sudo apt-get install python-dev
Run Code Online (Sandbox Code Playgroud)

或运行:

sudo apt-get build-dep python
Run Code Online (Sandbox Code Playgroud)

并获得一些在编译Python C扩展时派上用场的软件包.

在Fedora(Pidora)上,相当于最后一个命令是:

sudo yum install yum-utils
sudo yum-builddep python
Run Code Online (Sandbox Code Playgroud)

  • 如果您最近遇到同样的问题,就像我一样,您可能需要输入 `sudo apt-get install python3-dev` (3认同)