Learn how to Install Python 3.9 on Ubuntu

· >
Learn to Install Python on Ubuntu

In this article we shall learn how to install Python 3.9 on Ubuntu, but before diving straight to installation part lets learn what is Python? and What you can do with Python? Below is the table of content for this article if you wan to jump to installation part you can do so by clicking on relevant link.

What is Python?

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Python is the world’s fastest growing and most popular programming languages not just amongst programmers but also amongst mathematicians, data scientists, analysts, accountants and network engineers. Python is very beginner friendly language.

What you can do with Python?

So people from different disciplines use Python for a variety of different tasks, such as data analysis and visualization, artificial intelligence and machine learning, and automation. In fact this is one of the big uses of Python amongst people who are not software developers. If you constantly have to do boring, repetitive tasks, such as copying files and folders around, renaming them, uploading them to a server, you can easily write a Python script to automate all that and save your time.

Python 3.9 is the latest major release of the Python language. It includes many new features such as new dict operators, new str functions, support for IANA time zone etc.

In this article we’ll teach you how you can kick start your python learning journey by installing it on your Ubuntu machine, right now.

Installing Python 3.9 From Source

Well there is an easy way of installing python using apt command, however in this tutorial we shall be compiling Python from sources as it gives your flexibility of customization of build options which is not available in apt package manager.

Install Dependencies

Open up the terminal with user having sudo privilege’s or change to root user before proceeding for installation. Then from terminal execute below commands by simply copying and pasting in the terminal.

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

Download Python Latest Release

Then download python latest release source code using wget command. Once download has been completed untar the zipped archive using tar command.

wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
tar -xvf Python-3.9.1.tgz


Execute Configure Script

Navigate to the Python source directory and execute the configure script with “–enable-optimizations” option to optimize Python binaries. This runs a number of checks to make sure all of the dependencies on your system are present.

$ cd Python-3.9.1./configure --enable-optimizations

Build Process & Install Python

Next we shall build process using make command

sudo make -j

Once build process is complete, we shall install Python libraries using “altinstall”.

sudo make altinstall

That’s it, we have successfully installed Python from sources on our Ubuntu machine. I hope this has been informative for you and would like to thank you for viewing.

Notify of
Inline Feedbacks
View all comments