pip安装软件时出现错误:command ′gcc′ failed with exit status 1
更新时间 2025-08-05 15:01:50
最近更新时间: 2025-08-05 15:01:50
本文为您介绍pip安装软件时出现错误:command ′gcc′ failed with exit status 1的解决办法。
瓣產媚菏羆Ы┾浪ノ猳单11摸珇 9уΩぃ
百度 今天我们如何过清明,从形式到内容都值得深思。在通过 yum 或 rpm 命令确认已经安装了 gcc 的前提下,通过 pip 安装指定 Python 库时会出现报错:command ′gcc′ failed with exit status 1。
问题原因
系统缺少gcc编译需要的 openssl-devel、python-devel 等系统包支持。
解决步骤
以安装 Python 库 psutil 的5.4.3 版本为例:
-
通过执行如下命令,安装 openssl-devel 和 python-devel,同时安装相关依赖。
yum install -y openssl-devel libffi-devel gcc yum install -y python-devel
若您使用的是 Python3,则可能需要执行如下命令代替上述命令中的第 2 行(即 python3-devel 替换 python-devel):
yum install -y python3-devel
-
再次通过 pip 安装,可以看到安装成功,没有报错。