python - 错误 : command 'gcc' failed with exit status 1 on CentOS

标签 python linux bash pip 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"

希望这会有所帮助。

关于python - 错误 : command 'gcc' failed with exit status 1 on CentOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19955775/

相关文章:

linux - 将 Git Push 保存到输出文件

linux - 为什么这行 Shell 在 eval() 中有效但在 bash 中失败

python - 机器学习——从当前数据集生成新数据

python - 如何从调用方法的函数中修补参数?

python - 使用基于示例的代码暂停动画时遇到问题

php - 调用未定义函数 mssql_connect() linux 托管

linux - 如何杀死不存在的程序进程

linux - 如何使用 wget 从 Sonatype Nexus 下载工件

linux - 如何在 scp 期间禁用 CTRL-C?

python - 使用boto3在python中自动填充DynamoDB中的时间戳