如何在red hat 7上安装python3-devel

时间:2017-03-27 13:04:49

标签: python-3.x install virtualenv rhel7

我正在尝试在我的虚拟环境中安装一些东西,它使用anaconda python 3.6。我得到the gcc failed with exit status 1,暗示缺少正确的python3-devel包,如error: command 'gcc' failed with exit status 1 while installing eventlet中所述。

要修复错误,我尝试在运行RHEL 7.3的服务器上安装python3-devel软件包。 我做了yum install python3-devel,但收到了'package not found'错误。然后我找到https://serverfault.com/questions/710354/repository-for-python3-devel-on-centos-7,它提示EPEL存储库中的python34-devel包。我使用yum安装它,但在尝试在我的虚拟环境中安装某些东西时,仍然会出现the gcc failed with exit status 1错误。

有人知道如何解决这个问题吗?所有的帮助都会很有用。

3 个答案:

答案 0 :(得分:44)

在yum中搜索包,请使用以下命令:

yum search python3 | grep devel

它将列出所有可用的开发包。结果有点像这样

python3-cairo-devel.x86_64 : Libraries and headers for python3-cairo
python3-devel.x86_64 : Libraries and header files needed for Python 3
                     : development
python34-devel.x86_64 : Libraries and header files needed for Python 3
                      : development

然后您可以从列表中选择要安装的软件包,假设您要安装python3-devel,请执行以下命令

yum install -y python3-devel.x86_64

答案 1 :(得分:6)

在Red Hat Enterprise Linux 6或7中没有来自Red Hat的python3-*软件包。

但是,如果您启用了第三方存储库(例如EPEL或IUS),则有python3-*个软件包可用。但是,红帽不支持这些功能。如果您正在运行RHEL,则您的组织可能会优先选择受支持的软件包。

您可以通过Red Hat Software Collections(RHSCL)从Red Hat获得受支持的Python 3软件包。当前Python 3.6是最新可用的,程序包名称是rh-python36。安装RHSCL软件包还将安装rh-python36-devel和许多其他软件包。

请参见How to install Python 3, pip, venv, virtualenv, and pipenv on RHEL

别忘了先安装@development,这样您就可以使用gcc,make等来构建任何动态加载的共享对象。

要安装:

$ su -
# subscription-manager repos --enable rhel-7-server-optional-rpms \
  --enable rhel-server-rhscl-7-rpms
# yum -y install @development
# yum -y install rh-python36

# yum -y install rh-python36-numpy \
 rh-python36-scipy \ 
 rh-python36-python-tools \
 rh-python36-python-six

# exit

上面链接的博客提供了许多有关使用Python,虚拟环境以及Red Hat上的软件集合的技巧。

答案 2 :(得分:3)

我想我可能会在2020年进行更新。从RHEL 7.7开始,python-devel在EPEL中不可用,它已被Fedora Project淘汰。我今天想要的只是python h文件,这使我到了那里:

# yum install python3-devel.x86_64 --enablerepo=rhel-7-server-optional-rpms

我们确实拥有Redhat No-Cost Developer许可之一,但我不确定可选rpm是否必需。

PS,这有助于验证感兴趣的软件包是否在可选rpm中

# yum repo-pkgs rhel-7-server-optional-rpms list | grep python3
相关问题