繁体   English   中英

错误:命令“gcc”在 CentOS 上失败,退出状态为 1

[英]error: command 'gcc' failed with exit status 1 on CentOS

我正在尝试使用sudo pip install lxml在 CentOS 上安装 lxml 包,并在最后抛出此错误:

错误:

error: command 'gcc' failed with exit status 1

---------------------------------------

Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-PjviBq-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/lxml
Storing complete log in /root/.pip/pip.log

[hg@user-centos-1 ~]$ error: command 'gcc' failed with exit status 1
bash: error:: command not found

“错误:命令‘gcc’失败,退出状态为 1”。 由于缺少 python-devel 和一些依赖项,安装失败。

纠正gcc问题的最佳方法:

您需要重新安装 gcc 、 gcc-c++ 和依赖项。

对于python 2.7

$ sudo yum -y install gcc gcc-c++ kernel-devel
$ sudo yum -y install python-devel libxslt-devel libffi-devel openssl-devel
$ pip install "your python packet"

对于python 3.4

$ sudo apt-get install python3-dev
$ pip install "your python packet"

希望这会有所帮助。

gcc 安装了吗?

sudo yum install gcc

我打赌你必须安装libxml2-devellibxml++-devel甚至python-devel 但这只是一个疯狂的猜测,没有从日志文件中看到实际的错误。 但似乎gcc缺少头文件或库文件。

sudo yum install python36 python36-devel python36-libs python36-tools

如果使用python36,这是设置的最佳路径。 在 aws ec2 实例上为我纠正了这个错误

我是怎么解决的

# yum update
# yum install -y https://centos7.iuscommunity.org/ius-release.rpm
# yum install -y python36u python36u-libs python36u-devel python36u-pip
# pip3.6 install pipenv

我希望它会帮助某人解决“gcc”问题。

yum install gcc-c++

在 aws ec2(aws linux)上,它有效

优秀

pip install -U pip
pip install -U cython

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM