How to install python3-devel on red hat 7

Search for the package in yum , use the following command:

yum search python3 | grep devel

It will list all the available devel packages. The result will be somewhat like this

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

Then you can choose the package you want to install from the list , suppose if you want to to install python3-devel , execute the following

yum install -y python3-devel.x86_64

There are no python3-* packages from Red Hat in Red Hat Enterprise Linux 6 or 7.

However there are python3-* packages available if you enable third party repos like EPEL or IUS. But, these are not supported by Red Hat. Chances are if you are running RHEL, your organization has a preference for supported packages.

You can get supported Python 3 packages from Red Hat via Red Hat Software Collections (RHSCL). Currently Python 3.6 is the newest available, the package name is rh-python36. Installing the RHSCL package will also install rh-python36-devel and a number of other packages.

See How to install Python 3, pip, venv, virtualenv, and pipenv on RHEL

Don't forget to install @development first, so you have gcc, make, etc. for building any dynamically loaded shared objects.

To install:

$ 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

The blog linked above has lots of tips for working with Python, virtual environments, as well as software collections on Red Hat.


I thought I might update this for 2020. As of RHEL 7.7, python-devel is not available in EPEL, it has been retired by Fedora Project. All I wanted for today was the python h files, and this got me there:

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

We do have one of the Redhat No-Cost Developer licenses, but I am not sure that is required for the optional-rpms.

PS, this was helpful in verifying which packages of interest were in optional-rpms

# yum repo-pkgs rhel-7-server-optional-rpms list | grep python3