Install Python 2 on Ubuntu 20.04 Focal Fossa Linux

This tutorial will show how to install Python2 for Ubuntu 20.04 Focal Fossa Linux. Python 2 has not been the default installed version on Ubuntu for a few years, but it’s still possible to install Python2 and to install Python 2.7 on Ubuntu.

Follow the step by step instructions below to see how to install Python 2 and use it as the default Python interpreter on Ubuntu.

In this tutorial you will learn:

  • How to install Python2 Ubuntu 20.04
  • How to switch Python 2 as a default python interpreter

Install Python 2 on Ubuntu 20.04 Focal Fossa Linux

Install Python 2 on Ubuntu 20.04 Focal Fossa Linux

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa
Software Python 2
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Install Python 2 on Ubuntu 20.04 step by step instructions

  1. To install Python 2 version on Ubuntu 20.04 open a terminal and enter the following commands:
    $ sudo apt update
    $ sudo apt install python2
    


  2. Check your current Python version:
    $ python2 -V
    Python 2.7.17
    
  3. Follow our tutorial on how to switch to Python 2 from Python 3 as a default version on Ubuntu 20.04. You may also be interested to install Python package manager on your Ubuntu 20.04 system.
SEE ALSO
Check out our tutorial on Python Programming Fundamentals for a crash course into Python and all the basics you will need to get started with coding your own Python scripts and programs.

Closing Thoughts

In this guide, we saw how to install Python2 on Ubuntu 20.04. In particular, you saw how to install Python 2.7 on Ubuntu 20.04, which is the last release of Python 2, from April 2020. Although this version is now deprecated, it can still be installed and used for legacy purposes on Ubuntu and other Linux systems.