Python has gone through tremendous improvement in the past few years.
There was a time when Python 2.7 was alongside the Python 3 versions. Yet, versions in major release three have outgrown the 2.7. As a result, Python officially ended support for 2.7 in 2020.
Meanwhile, the subsequent versions of Python 3 have excellent improvements. The introduction of f-strings in version 3.6, data classes in 3.10, and performance boost in 3.11 are noticeable improvements.
The next exciting Python release is 3.12. The stable version will arrive in 2023. Meanwhile, you can install the development prerelease on Ubuntu OS using the steps outlined in this article.
Installing Python3.12 on Ubuntu
To install Python 3.12 on Ubuntu, you can follow these steps:
1. Make sure that you have the necessary dependencies installed by running the following command:
2. Download the latest version of Python 3.12 from the Python downloads page at https://www.python.org/downloads/. At the time of writing, the latest version of Python 3.12 is 3.12.0a5.
3. Open a terminal and navigate to the directory where you downloaded the Python 3.12 tarball.
4. Extract the tarball by running the following command:
5. Change into the extracted directory:
6. Run the following command to configure the build:
7. Build and install Python 3.12 by running the following commands:
Please note that Python’s development version is unsuitable for production use, as it may contain bugs and unfinished features. It is intended for testing and development purposes only.
If you want to install the latest stable release of Python 3.12 on Ubuntu, you can follow the same steps but download the latest stable release from the Python downloads page instead of the development version.
Test your Python 3.12 Installation
After installing Python 3.12 on Ubuntu, you can access it in a few different ways:
2. You can also use the
python3.12 command to enter the Python interactive interpreter, which allows you to enter and execute Python commands directly. To start the interactive interpreter, run the python3.12 command with no arguments:
3. If you have multiple versions of Python installed on your system and want to ensure that Python 3.12 is the default version, you can update the python and python3 symlinks to point to Python 3.12. For example, you can run the following commands to update the symlinks:
Please note that these instructions are specific to Ubuntu, and the exact steps may vary depending on your particular distribution and installation method.
Python 3.12 is still in development, so it is unsuitable for production use. It is only intended for testing and development purposes and may contain bugs and unfinished features.
That being said, Python 3.12 is expected to include several new features and improvements over previous versions of Python. You can find more information about the proposed features for Python 3.12 in the Python Developer’s Guide.
Not a Medium member yet? Please use this link to become a member because I earn a commission for referring at no extra cost for you.