Several leading universities worldwide utilize Python to introduce students to programming. Institutions such as the Massachusetts Institute of Technology (MIT), the University of Texas at Arlington, and Stanford serve as examples of those that extensively employ this language.
Furthermore, it is worth mentioning that Python proves beneficial for a broad spectrum of educational, corporate, and scientific purposes – ranging from web development to desktop applications to machine learning and everything in between.
[ You might also like: How to Install the Latest Python on Ubuntu ]At present, two primary versions of Python are in use – 2 and 3, with 2 quickly losing traction to 3, as the latter is no longer actively developed. Since most Linux distributions include Python 2.x, this remains relevant.
[ You might also like: Getting Started with Python and Scripting in Linux – Part 1 ]This article will demonstrate how to install and use the latest Python version in RHEL-based distributions and Debian and its derivatives such as Ubuntu (the latest LTS version already includes the latest Python) or Linux Mint. Our emphasis will be on installing the core language tools usable in the command line.
Nonetheless, we will also clarify how to install Python IDLE – a GUI-based tool enabling the execution of Python code and the creation of standalone functions.
Installing Python on Linux from Source
As of this writing (November 2022), the latest version is Python 3.11, and we will proceed with the installation from the source.
Even though we can install the core packages and their dependencies using yum and aptitude (or apt-get) or apt.
Why? The rationale is straightforward: this approach ensures access to the latest stable release of the language (3.11) and provides a distribution-independent installation method.
Before installing Python in RHEL-based distributions like CentOS Stream, Fedora, Rocky, and AlmaLinux, confirm that your system has all necessary development dependencies:
<code># yum -y groupinstall development # yum -y install zlib-devel</code>
In Debian-based distributions such as Ubuntu and Linux Mint, we must install gcc, make, and the zlib compression/decompression library:
<code># aptitude -y install gcc make zlib1g-dev</code>
After ensuring all essential packages are installed, proceed to the official Python download page to fetch the Python 3.11 source release or execute the following wget command to download it directly and install it.
<code># wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tar.xz # tar xJf Python-3.11.0.tar.xz # cd Python-3.11.0 # ./configure # make # make install</code>
Take a break and enjoy a snack because this process might take some time. Upon completion, verify the location of the main binary using which:
<code># which python3 # python3 -V # python3</code>
The output should resemble:
<code>[root@tecmint:~/Python-3.11.0]# which python3 <strong>/usr/local/bin/python3</strong> [root@tecmint:~/Python-3.11.0]# python3 -V <strong>Python 3.11.0</strong> [root@tecmint:~/Python-3.11.0]# python3 Python 3.11.0 (main, Nov 15 2022, 09:50:56) [GCC 8.5.0 20210514 (Red Hat 8.5.0-10)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> quit Use quit() or Ctrl-D (i.e. EOF) to exit >>> quit()</code>
Congratulations! Python 3.11 is now installed on your system.
Installing Python IDLE on Linux
Python IDLE is a GUI-based tool for Python. To install Python IDLE, obtain the package named idle (Debian) or python-tools (RHEL).
<code># yum install python3-idle [On <strong>RHEL/CentOS/Fedora</strong> and <strong>Rocky Linux/AlmaLinux</strong>] # apt-get install idle [On <strong>Debian, Ubuntu and Mint</strong>]</code>
Start the Python IDLE by typing:
<code># idle3 Or # idle</code>
Summary
This article has outlined the steps to install the latest Python stable version from the source.
Lastly, if you're transitioning from Python 2, consider reviewing the 2to3 official documentation. This program translates Python 2 code into valid Python 3 code.
Are you curious or have feedback regarding this article? Feel free to reach out to us via the form provided below.
The above is the detailed content of How to Install Python in RHEL and Debian Systems. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

While writing program files or normal text files, programmers and writers sometimes want to know the difference between two files or two versions of the same file. When you compare two computer files on Linux, the difference between their contents is

There are three ways to create empty files in the command line: First, the simplest and safest use of the touch command, which is suitable for debugging scripts or placeholder files; Second, it is quickly created through > redirection but will clear existing content, which is suitable for initializing log files; Third, use echo"> file name to create a file with an empty string, or use echo-n""> file name to avoid line breaks. These three methods have their own applicable scenarios, and choosing the right method can help you complete the task more efficiently.

Are you looking for good software to write mathematical equations? If so, this article provides the top 5 equation editors that you can easily install on your favorite Linux distribution.In addition to being compatible with different types of mathema

dutree is a free, open-source, fast command-line tool for analyzing disk usage, written in the Rust programming language. It was created by combining durep (disk usage reporter) and tree (list directory content in tree-like format) command-line tools

Eclipse is a free integrated development environment (IDE) that programmers around the world use to write software, primarily in Java, but also in other major programming languages using Eclipse plugins.The latest release of Eclipse IDE 2023?06 does

ifconfig in short “interface configuration” utility for system/network administration in Unix/Linux operating systems to configure, manage, and query network interface parameters via command-line interface or in a system configuration scripts

Linux administrators should be familiar with the command-line environment. Since GUI (Graphical User Interface) mode in Linux servers is not commonly installed.SSH may be the most popular protocol to enable Linux administrators to manage the servers

Linux has a rich collection of commands, and while many of them are powerful and useful for various tasks, there are also some funny and whimsical commands that you can try out for amusement. 1. sl Command (Steam Locomotive) You might be aware of the
