Linux 错误:命令“gcc”在 CentOS 上失败,退出状态为 1
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19955775/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
error: command 'gcc' failed with exit status 1 on CentOS
提问by Simple-Solution
I'm trying to install lxml package on CentOS using sudo pip install lxml
and its throwing this error right at the end:
我正在尝试使用在 CentOS 上安装 lxml 包,sudo pip install lxml
并在最后抛出此错误:
error:
错误:
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
采纳答案by Alex Harvey
Is gcc installed?
gcc 安装了吗?
sudo yum install gcc
回答by damienfrancois
I bet you have to install libxml2-devel
or libxml++-devel
or even python-devel
. But it is only a wild guess, not seeing the actual error from the log file. But it seems gcc
is missing either a header file or a library file.
我敢打赌,你必须安装libxml2-devel
或libxml++-devel
甚至python-devel
。但这只是一个疯狂的猜测,没有从日志文件中看到实际的错误。但它似乎gcc
缺少头文件或库文件。
回答by Coko Tracy Musaza
" error: command 'gcc' failed with exit status 1 ". the installation failed because of missing python-devel and some dependencies.
“错误:命令‘gcc’失败,退出状态为 1”。由于缺少 python-devel 和一些依赖项,安装失败。
the best way to correct gcc problem:
纠正gcc问题的最佳方法:
You need to reinstall gcc , gcc-c++ and dependencies.
您需要重新安装 gcc 、 gcc-c++ 和依赖项。
For python 2.7
对于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"
For python 3.4
对于python 3.4
$ sudo apt-get install python3-dev
$ pip install "your python packet"
Hope this will help.
希望这会有所帮助。
回答by Rahul Saini
How i solved
我是怎么解决的
# 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
I hope it will help Someone to resolve "gcc" issue.
我希望它会帮助某人解决“gcc”问题。
回答by Jacob Solawetz
sudo yum install python36 python36-devel python36-libs python36-tools
if using python36, this is the best path for set up. Corrected this error for me on an aws ec2 instance
如果使用python36,这是设置的最佳路径。在 aws ec2 实例上为我纠正了这个错误