How to Install Python on Ubuntu 20.04 and 18.04?

Python is one of the most important programming languages today. It has become the second most popular language displacing JAVA as per the TIOBE Language Index. Maybe someday, it will overtake C as well.

Learning Python would be a great investment. 

In this post, we will share how to install Python in Ubuntu 20.04 and 18.04. Your first step in learning Python.

Briefly, what is Python?

Python is an interpreted, object-oriented, and high-level programming language. It is very popular because it is multi-purpose and multi-paradigm. One of the best and most important features of Python is simple, easy to learn syntax.

This makes it quite flexible and therefore you will find Python in web applications, desktop, system-level, and even in configuration scripts. Support of modules and packages makes it modular and encourages code reuse. That means you write clean and good code.

Below are some of the features,

  1. Open Source
  2. Simple and Elegant Syntax
  3. Object-Oriented
  4. Automatic Memory Management
  5. Availability of a large number of modules/libraries for common tasks.
  6. Runs on Windows, Mac, and Linux

You can visit BeginnersGuide/Overview – Python Wiki for additional details.

Install Python on Ubuntu 20.04

Python is pre-installed in most of the Linux Distributions. Ubuntu 20.04 the latest LTS version has version 3.8.

So go ahead, open a terminal and run the below command to check the python version.

$ python3 --version
Python 3.8.2

The latest Python is available and ready to use.

Python is also available on Ubuntu 18.04, but the version is outdated. Quite obvious as Ubuntu 18.04 was released two years ago.

Either Upgrade Ubuntu to version 20.04 or upgrade Python to the latest version.

Steps,

1. Open up a terminal, and add the PPA Deadsnakes as shown below.

sudo add-apt-repository ppa:deadsnakes/ppa

2. Then refresh the APT cache.

sudo apt update

3. Run the below command to install the latest Python version 3.8

sudo apt install python3.8

4. Check the version.

$ python3.8 --version
Python 3.8.3

That’s it…!

You have successfully installed/upgraded Python to the latest version on Ubuntu 18.04

Conclusion

Ubuntu does come with Python pre-installed, but it may have an older version. You can take advantage of the new features of Python by upgrading it to the latest version.

What Next..

  1. Install Pip on Ubuntu – Package Manager for Python
  2. Install PyCharm – the professional IDE for Python

I hope you found this article helpful. Please share and subscribe.

Share This: