How To Install Python 3.9 On CentOS 8
In this short tutorial we will learn how to iinstall Python 3.9 on CentOS 8 operating system.
Introduction
Python 3.9 is the latest version of the Python programming language, released in October 2020. It includes several new features and improvements over previous versions, including:
- Performance improvements: Python 3.9 includes a number of performance improvements, including faster method calls, faster dictionary operations, and faster parsing of data structures.
- Type hinting: Python 3.9 adds support for more precise types in function signatures, allowing developers to catch type errors earlier in the development process.
- New syntax features: Python 3.9 adds a number of new syntax features, including support for structural pattern matching, improved decorators, and more flexible string handling.
- Improved time zone support: Python 3.9 includes improvements to the handling of time zones, making it easier to work with dates and times across different time zones.
- Other improvements: Python 3.9 also includes a number of other improvements, such as better error messages, improved support for concurrent programming, and improved support for the import system.
Python 3.9 is a significant update to the language and includes many improvements and new features that make it a great choice for developing a wide range of applications. It is backward-compatible with earlier versions of Python, so existing Python code should run without any issues on Python 3.9.
Python 3.9 Installation On CentOS 8
Prerequisites
The Python 3.9 installation required the GCC compiler on our system. We will verify, if our system has GCC installed.For this purpose we will submit the following command line :
$ gcc --version
Output :
[ramans@diginetapp02 ~]$ gcc --version gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If we have no GCC compiler yet, then we have to install prerequisites packages.
Then Python 3.9 Installation on CentOS 8 step will be mentined below :
- Download Python 3.9
- Install Python on CentOS 8
- Verifying Python Version
1. Download Python 3.9
At this step, we will download the latest Python 3.9 by using wget command line as shown below :
$ wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz
Output :
[ramans@diginetapp02 ~]$ wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz --2021-10-06 19:07:44-- https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz Resolving www.python.org (www.python.org)... 199.232.44.223, 2a04:4e42:48::223 Connecting to www.python.org (www.python.org)|199.232.44.223|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 25755357 (25M) [application/octet-stream] Saving to: ‘Python-3.9.7.tgz’ Python-3.9.7.tgz 100%[==================================>] 24.56M 3.05MB/s in 8.7s 2021-10-06 19:07:53 (2.82 MB/s) - ‘Python-3.9.7.tgz’ saved [25755357/25755357]
2. Install Python 3.9 On CentOS 8
After downloading Python 3.9 source, then we will install it by following these steps :
1. extract the Python 3.9 tarball, by submitting command line :
$ tar xzf Python-3.9.7.tgz
2. Install Python 3.9
$ cd Python-3.9.7/ $ ./configure --enable-optimizations
The output :
[ramans@diginetapp02 ~]$ cd Python-3.9.7/ [ramans@diginetapp02 Python-3.9.7]$ ./configure --enable-optimizations checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for python3.9... no checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... "linux" checking for gcc... gcc checking whether the C compiler works... yes ... checking whether compiling and linking against OpenSSL works... no checking for --with-ssl-default-suites... python checking for --with-builtin-hashlib-hashes... md5,sha1,sha256,sha512,sha3,blake2 configure: creating ./config.status config.status: creating Makefile.pre config.status: creating Misc/python.pc config.status: creating Misc/python-embed.pc config.status: creating Misc/python-config.sh config.status: creating Modules/ld_so_aix config.status: creating pyconfig.h creating Modules/Setup.local creating Makefile
Then we will build Python 3.9 on CentOS 8, by submitting command line :
$ sudo make altinstall
3. Verifying Python 3.9
After installation was completed done, then we will verify its version, by submitting command line below :
$ python3.9 --version
Output :
[ramans@diginetapp02 ~]$ python3.9 --version [ramans@diginetapp02 ~]$ Python 3.9.7
Conclusion
The Python 3.9 installation was completed done. I hope this tutorial will be helpful.