How to Install Python 3.9 on Linux Mint 20? (2024)

Python is popular and is almost used in every type of computer science project. However, it has gained a lot of popularity in Artificial intelligence and its associated fields like Machine Learning, Deep Learning, etc.

Python 3.9 is the latest major release of Python. It is leveraged with many updates.

Python 3.9 is available from the deadsnakes PPA repository. Moreover, we can also build Python on Linux Mint 20 from the source code.

Installing Python 3.9 on Linux Mint 20 from the PPA repository

Installing Python 3.9 on Linux Mint 20 from the deadsnakes PPA repository is very easy and straightforward.

Perform the below-given steps to install Python 3.9 on Linux Mint 20 from the deadsnakes repository:

Step 1: Update apt cache
Fire up the terminal and update the apt cache with the command:

$ sudo apt update

How to Install Python 3.9 on Linux Mint 20? (1)

Step 2: Install the dependencies
Next, type the command to install the required dependencies that are a prerequisite of Python 3.9:

$ sudo apt install software-properties-common

How to Install Python 3.9 on Linux Mint 20? (2)

Step 3: Add PPA repository
Next, add the PPA repository:

$ sudo add-apt-repository ppa:deadsnakes/ppa

How to Install Python 3.9 on Linux Mint 20? (3)

How to Install Python 3.9 on Linux Mint 20? (4)

Step 4: Install Python 3.9
Install Python 3.9 as follows:

$ sudo apt install python3.9

How to Install Python 3.9 on Linux Mint 20? (5)

Press ‘y’ to continue installing Python 3.9.

How to Install Python 3.9 on Linux Mint 20? (6)

Step 5: Verify the Python 3.9 installation
After installing Python 3.9, verify the installation with the command:

$ python3.9 --version

How to Install Python 3.9 on Linux Mint 20? (7)

Python 3.9 is successfully installed on Linux Mint 20.

Note: In case if you face any dependency issue after installing Python 3.9, then run the below-given command to fix the issue:

$ sudo apt-get -f install

Installing Python 3.9 on Linux Mint 20 from the source code

This is another way of installing Python 3.9 Linux Mint 20. It is not recommended to install Python 3.9 from the source code. However, you may need it in various situations.

Perform the below-given steps to install Python 3.9:

Step 1: Install required dependencies for Python 3.9
First, update the apt repository and install dependencies:

$ sudo apt update

How to Install Python 3.9 on Linux Mint 20? (8)

$ sudo apt install libffi-dev libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev build-essential libreadline-dev wget libbz2-dev

How to Install Python 3.9 on Linux Mint 20? (9)

How to Install Python 3.9 on Linux Mint 20? (10)

Step 2: Get the Python 3.9 source code
Next, get the latest Python 3.9 source code with the wget command:

$ wget <a href="https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz">https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz</a>

How to Install Python 3.9 on Linux Mint 20? (11)

Step 3: Extract Python 3.9 source code tar file
When the Python 3.9 source code tar file is downloaded, extract the archive with the command:

$ tar -xf Python-3.9.1.tgz

How to Install Python 3.9 on Linux Mint 20? (12)

Step 4: Run configure script
Next, navigate to the Python 3.9.1 directory and run the configure script:

$ cd Python-3.9.1

How to Install Python 3.9 on Linux Mint 20? (13)

$ ./configure --enable-optimizations

How to Install Python 3.9 on Linux Mint 20? (14)

The –enable-optimizations run the various tests and improves the configuration process.

Step 5: Build Python 3.9
Once Python 3.9 is configured, the next step is to build it with the command:

$ make -j

How to Install Python 3.9 on Linux Mint 20? (15)

To make the build process faster, you can also specify the number of cores with the –j option as follows:

$ make -j 8

Step 6: Install Python libraries
Next, install Python 3.9 with the command:

$ sudo make altinstall

How to Install Python 3.9 on Linux Mint 20? (16)

How to Install Python 3.9 on Linux Mint 20? (17)

The altinstall will overwrite the existing Python3 binary.

Python 3.9 is installed successfully.

Conclusion

Python 3.9 is the newest release of Python. It is available from the deadsnakes repository and source code. This post explains the Python 3.9 installation on Linux Mint 20.

How to Install Python 3.9 on Linux Mint 20? (2024)
Top Articles
Latest Posts
Article information

Author: Rueben Jacobs

Last Updated:

Views: 6168

Rating: 4.7 / 5 (77 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Rueben Jacobs

Birthday: 1999-03-14

Address: 951 Caterina Walk, Schambergerside, CA 67667-0896

Phone: +6881806848632

Job: Internal Education Planner

Hobby: Candle making, Cabaret, Poi, Gambling, Rock climbing, Wood carving, Computer programming

Introduction: My name is Rueben Jacobs, I am a cooperative, beautiful, kind, comfortable, glamorous, open, magnificent person who loves writing and wants to share my knowledge and understanding with you.