ubuntu install Python psutil模块报错如下:
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=520 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_linux.o
psutil/_psutil_linux.c:12:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
解决方法:
For Python version 2.x+
apt-get install python-dev
For Python version 3.x+
apt-get install python3-dev
本文介绍了在Ubuntu系统中安装Python的psutil模块时遇到的一个常见错误:找不到Python.h文件。针对不同版本的Python(2.x和3.x),提供了具体的解决方案,即通过包管理器apt-get安装相应的开发库。
31万+

被折叠的 条评论
为什么被折叠?



