gpt4 book ai didi

python - 树莓派 - psutil 安装错误

转载 作者:太空狗 更新时间:2023-10-29 20:34:50 24 4
gpt4 key购买 nike

我正在尝试在我的树莓派上安装 psutil,但我似乎无法开始工作。如果我执行 pip install 我会收到此错误:

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

如果我尝试从安装文件的目录中构建 python setup.py,我会收到此错误:

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

并获得一些在编译 Python C 扩展时派上用场的包。在较新的 Debian 版本中将 python 替换为 python3

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

sudo yum install yum-utils
sudo yum-builddep python

如果您的系统较新,您也可能需要将 python 替换为 python3

关于python - 树莓派 - psutil 安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18237484/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com