Python is a powerful programming language. It is very friendly and easy to learn. At the writing time of this article Python 3.8 latest stable version is available to download and install. This article will help you to install Python 3.8.12 on your CentOS, Red Hat & Fedora operating systems.

Advertisement

Step 1 – Install Required Packages

Use the following command to install prerequisites for Python before installing it.

sudo yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel

Step 2 – Download Python 3.8

Download Python using following command from python official site. You can also download the latest version in place of the specified below.

cd /opt
wget https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tgz

Now extract the downloaded package.

tar xzf Python-3.8.12.tgz

Step 3 – Compile Python Source

Use below set of commands to compile python source code on your system using altinstall.

cd Python-3.8.12
sudo ./configure --enable-optimizations
sudo make altinstall
make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

Now remove downloaded source archive file from your system

sudo rm Python-3.8.12.tgz

Step 4 – Check Python Version

Check the latest version installed of python using the following command.

python3.8 -V

Python 3.8.12
Share.

21 Comments

  1. In Step 1, I would also include zlib-devel. Not doing so throws error in “make altinstall” or “make install” step.

  2. Lo instale con root y todo funciona perfectamente pero tengo un problema, un usuario especifico no puede utilizar pip3.8, me recomiendas realizar la instalación con ese usuario utilizando sudo?

    anexo el mensaje:

    $ pip3.8 -V
    Traceback (most recent call last):
    File “/usr/local/bin/pip3.8”, line 6, in
    from pip._internal.cli.main import main
    ModuleNotFoundError: No module named ‘pip._internal’

    Saludos y espero puedan ayudarme.

  3. It seems to take forever, 10+ minutes now , message lines “checking” if, for variables listed alphabetically, and takes loops (?)

Leave A Reply

Exit mobile version