December 10, 2025
Tutorials

How to Install Python 3 on CentOS 10

How to Install Python3 on CentOS 10

Python 3 is a widely used programming language for AI, DevOps, and application development. It also has a server-side scripting capability. CentOS 10 comes with Python as a standard for system tools. However, you may not have the latest Python 3 for modern development and applications. Installing Python 3 is easy on CentOS 10. You can use the default repositories or alternative repositories such as EPEL. Or you can compile from source.

This guide explains all possible methods, each one step by step.

Table of Contents

How to Install Python 3 on CentOS 10

The easiest way to install Python 3 on CentOS 10 is to update your system with “sudo dnf update -y”, then install Python and pip using “sudo dnf install python3 python3-pip -y”, and verify the installation with “python3 –version”; alternatively, you can enable newer Python versions through EPEL or AppStream modules, or compile the latest release from source if you need the most up-to-date version, making Python installation flexible depending on your requirements.

Method 1: Install Python 3 from CentOS 10 Default Repositories (Recommended)

This is the most straightforward and stable method, which is ideal for most users.

Step 1: Update System Packages

By updating, you will install the most recent packages.

sudo dnf update

sudo dnf update

Step 2: Install Python 3 and pip

Install Python 3 and Pip directly from the CentOS repository.

sudo dnf install python3 python3-pip

Step 3: Verify Installation

Checks that Python 3 and Pip are installed correctly.

python3 –version

pip3 –version

Method 2: Install Python 3 from EPEL or AppStream Repository

When newer versions of the software are available through EPEL/AppStream modules.

Step 1: Install EPEL Repository

EPEL offers extra packages that are not included in base pricing.

sudo dnf install epel-release

Step 2: List Available Python Versions

Displays Python versions from AppStream or EPEL.

sudo dnf list available | grep python3

Step 3: Install Python 3

Installs the selected Python version.

sudo dnf install python3 -y

Step 4: Verify Installation

Checks that Python 3 and Pip are installed correctly.

python3 –version

Method 3: Install Python 3 by Compiling from Source (Latest Version)

The latest Python releases are not available on repositories.

Step 1: Install Build Dependencies

Python source code is required for compilation.

sudo dnf groupinstall “Development Tools”

Python source code is required for some dependencies:

sudo dnf install openssl-devel bzip2-devel libffi-devel

sudo dnf install openssl-devel bzip2-devel libffi-devel

Step 2: Download the Latest Python Source Code

Get the latest stable Python version from python.org.

curl -O https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz

curl -O https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz

Step 3: Extract the Tarball

Now, extract the Tarball as below:

tar -xvf Python-3.12.0.tgz

tar -xvf Python-3.12.0.tgz

Step 4: Configure the Build

Finally, optimizes compilation for your system:

cd Python-3.12.0

./configure –enable-optimizations

Configure the build python3

Step 5: Build Python

This step compiles your source code (may require 5-10 minutes).

make -j 4

make -j 4

Step 6: Install Python Safely

Altinstall is a good way to avoid reinstalling the Python system.

sudo make altinstall

sudo make altinstall

Step 7: Verify the Installed Version

Verify that the Version installed is correct

python3.12 –version

python3.12 --version

How to Set Python 3 as Default (Optional)

Be cautious if you are using Python 2.x on your system.

Step 1: Check Available Python Versions

Check the Available Python Versions

ls /usr/bin/python*

ls /usr/bin/python*

Step 2: Update Alternatives

Now, update the alternative or choose the particular Python version:

sudo alternatives –set python /usr/bin/python3

OR configure manually:

sudo alternatives –config python

sudo alternatives --config python

How to Uninstall Python 3 from CentOS 10

To uninstall the Python 3 version on CentOS 10, follow the methods below:

Uninstall repository-installed Python

Uninstall packages installed by the repository:

sudo dnf remove python3

sudo dnf remove python3

Uninstall pip-installed packages

Uninstall packages installed by pip:

pip3 uninstall package-name

Uninstall source-installed Python

Remove the installation directory:

sudo rm -rf /usr/local/bin/python3.12

sudo rm -rf /usr/local/lib/python3.12

Uninstall source-installed Python

That is all from the installation of Python 3 on CentOS 10.

Conclusion

Installing Python 3 is easy on CentOS 10. Update your system first with sudo update -y. Then install Python 3 and pip with sudo install python3 and python3 pip-y. Verify the installation using python3.

You can install Python 3 on CentOS 10 in a few simple steps. The method you choose will depend on your needs. The default repository is the most stable and easiest method, while EPEL/AppStream allows you to access newer versions. Compiling Python from source is best for users who need the latest release. Installing Python 3 on CentOS 10 will allow you to create applications, automate processes, and use the latest development tools.

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video