The command yum install python36-devel python36 gcc
allows you to install Python 3.6 along with the C compiler and development packages on CentOS, AlmaLinux, and RHEL-based systems. This process is often necessary for compiling Python modules (especially those written in C).
Packages Included in the Command:
-
python36
: Basic installation of Python version 3.6. -
python36-devel
: Includes header files and compilation tools for Python 3.6. It is especially required for some modules duringpip install
. -
gcc
: GNU C Compiler. It is mandatory for C-based Python modules to be compiled on the system.
When to Use?
-
When you get errors like "Python.h not found" while installing packages with
pip install
. -
When installing Python modules that require compilation, such as
uwsgi
,lxml
,cryptography
,numpy
,pandas
. -
When preparing system dependencies for Python-based web applications (Django, Flask, etc.).
Example Usage:
yum install -y python36 python36-devel gcc
What to Do Next:
You can install Python modules:
pip3 install numpy
pip3 install uwsgi
Or you can create a virtual environment for a specific project:
python3.6 -m venv venv
source venv/bin/activate
Things to Consider:
-
Python 3.6 is an old version. 3.8+ is recommended for new projects.
-
On
yum
-based systems, Python versions are provided through the EPEL (Extra Packages for Enterprise Linux) repository. If necessary, EPEL must be installed first:
yum install epel-release
-
On some systems, it may be named
python3
andpython3-devel
instead ofpython36
. Use the following for available package names:
yum search python3
This command ensures that the system is ready for preparing the Python environment and compiling C-based modules.