How to Install Python on Alma Linux 8
In 1991, Guido van Rossum introduced Python, a powerful and versatile programming language that has since become a favorite among…
How to Install Python on Alma Linux 8

In 1991, Guido van Rossum introduced Python, a powerful and versatile programming language that has since become a favorite among developers worldwide.
Python is renowned for its simplicity, readability, and clean syntax, making it an excellent choice for both beginners and experienced professionals. Its versatility spans various domains, including software development, automation, data analysis, and more.
AlmaLinux 8 is a community-driven, enterprise-grade Linux operating system that’s a binary-compatible alternative to Red Hat Enterprise Linux (RHEL) 8. Known for its stability, AlmaLinux 8 is a great platform for Python projects.
In this tutorial, we will discuss how to install Python on Alma Linux 8. However, before we move into the installation part, let us quickly examine the prerequisites.
The Prerequisites
Before you dive in, ensure you have the following:
- An AlmaLinux 8 operating system
- A user account with sudo or administrative privileges
- Terminal or command line access
Let us now discuss the steps in detail.
Step #1: Update Local Repository
Start by updating your local repository. This ensures you’re working with the latest package versions.
# sudo dnf update
Step #2: Install Python 3
Now that you have updated your repository, install Python 3 on AlmaLinux 8 with the following command:
# sudo dnf install python3
If you’re logged in as the root user, you can skip the sudo prefix.
Once you have installed Python, verify if it’s successfully installed by checking its version.
# python3 — version
If the output displays the installed version, you have successfully installed Python3.
Next, launch Python 3 with the following command:
# python3
Now that we have installed Python 3, let us also discuss how to install Python 2 as some older projects and scripts might still rely on Python 2.
How to Install Python 2 on AlmaLinux 8
Note that Python 2 has reached its end-of-life in 2020 and no longer receives security updates or bug fixes. Therefore, we recommend Python 3 over Python 2.
Start by updating the package list with the following command:
# sudo dnf update
Install Python 2 on AlmaLinux 8 with the following command:
# sudo dnf install python2
You will be prompted to confirm the installation. Type Y and press Enter.
Once the installation is completed, verify it by checking its version:
# python2 — version
The output should display the installed version.
Next, run the following command to launch Python 2:
# python2
How to Set the Default Python Version
AlmaLinux 8 might have multiple Python versions installed (e.g., Python 2 and Python 3). Setting a default version ensures that commands like python use the right version.
Before making changes, check the currently set Python version:
# readlink -f /usr/bin/python
Now, to set Python 3 as the default version, run the following command:
# sudo alternatives — set python /usr/bin/python3
On the other hand, if you want to set Python 2 as the default version, use the following command:
# sudo alternatives — set python /usr/bin/python2
To allow the system to automatically manage the python command (e.g., based on available packages and system configuration), run the following command:
# sudo alternatives — auto python
How to Uninstall Python on AlmaLinux 8
Knowing how to uninstall Python is as important as installing it.
Note: Removing Python completely might break system dependencies and affect the functionality of critical system tools. Proceed with caution and only uninstall if you are certain it won’t cause issues.
If you want to remove Python 3, use the following command:
# sudo dnf remove python3
You will be prompted to confirm the removal. Type Y and press Enter.
This will uninstall Python 3 and its dependencies.
Now if you want to remove the Python 2 package and its dependencies, run the following command:
# sudo dnf remove python2
Confirm the removal by typing Y and then press Enter.
Conclusion
Installing Python on AlmaLinux 8 is a straightforward process that equips your system with a powerful programming language for various applications.
Whether you need Python 2 or Python 3, this guide provides clear steps to install, verify, and manage your Python environment.
By setting the default version, you can ensure compatibility with your projects and applications.
With Python now installed, you’re ready to explore its capabilities for development, automation, and more.
메타데이터
- post_id
- 1e4770cee9be
- slug
- how-to-install-python-on-alma-linux-8-1e4770cee9be
- url
- https://medium.com/@redswitches/how-to-install-python-on-alma-linux-8-1e4770cee9be
- canonical_url
- https://medium.com/@redswitches/how-to-install-python-on-alma-linux-8-1e4770cee9be
- author_url
- https://medium.com/@redswitches
- status
- ok
- fetched_at
- 2026-08-03 03:40:02