error: command ‘gcc’ failed with exit status 1]

pip3 install elastalert

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/


Installing collected packages: blist, jmespath, python-dateutil, docutils, botocore, s3transfer, boto3, configparser, natsort, croniter, elasticsearch, envparse, exotel, PyJWT, pycparser, cffi, cryptography, oauthlib, requests-oauthlib, pbr, defusedxml, requests-toolbelt, jira, zipp, importlib-metadata, attrs, pyrsistent, jsonschema, mock, prison, PyStaticConfiguration, PyYAML, docopt, stomp.py, texttable, pysocks, twilio, python-magic, elastalert
Running setup.py install for blist ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-xiksccys/blist/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-xqk5v3zc-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/blist
copying blist/init.py -> build/lib.linux-x86_64-3.6/blist
copying blist/_sortedlist.py -> build/lib.linux-x86_64-3.6/blist
copying blist/_btuple.py -> build/lib.linux-x86_64-3.6/blist
copying blist/_sorteddict.py -> build/lib.linux-x86_64-3.6/blist
running build_ext
building 'blist._blist' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/blist
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 -DBLIST_FLOAT_RADIX_SORT=1 -I/usr/include/python3.6m -c blist/_blist.c -o build/temp.linux-x86_64-3.6/blist/_blist.o
blist/_blist.c:38: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-xiksccys/blist/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-xqk5v3zc-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-xiksccys/blist/

解决方法

1、安装运行库:

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

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

| yum python3-devel -y |

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容