Install Python 2 on Ubuntu 20.04 Focal Fossa Linux

The Python 2 version is no longer a default Python version since Ubuntu 18.04. With a release of Ubuntu 20.04 the Python 2 on a default system installation has been also completely dropped hence you might encounter the following error when executing the python command:

Command 'python' not found

No despair, the Python 2 is not installed by default but it is still available for installation.

In this tutorial you will learn:

  • How to install Python 2
  • 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 one of the following commands:
    $ sudo apt install python2
    OR
    $ sudo apt install python-minimal
    
    


  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.