Centos7下psutil安装报错:error: command ‘gcc’ failed with exit status 1

报错信息


gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=562 -DPSUTIL_LINUX=1 -I/usr/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-oezyfnwa/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-t35lao3y-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-oezyfnwa/psutil/

 

 

解决方法

 

1、安装运行库:

yum install gcc libffi-devel python-devel openssl-devel -y

2、若python3是使用yum安装的,则安装python3的devel环境

yum python3-devel -y
上一篇:用python来查看电脑的CPU的核心个数


下一篇:疯狂Java讲义(一)