How to Install Python 2 on Ubuntu 20.04
On Ubuntu 20.04, The python included in the base system is Python 3.8. Python 2.7 is not included by default in any new installs. Ubuntu release notes.
We will see how to install Python 2.7 now
Login to your Ubuntu 20.04 server.
Run the following command to install Python 2 version. During the time of installation it'll ask you permission to install Python 2 press "Y" to continue.
apt install python2
Output:
root@vps:~# apt install python2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib python2-minimal
python2.7 python2.7-minimal
Suggested packages:
python2-doc python-tk python2.7-doc binutils binfmt-support
The following NEW packages will be installed:
libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib python2
python2-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,827 kB of archives.
After this operation, 16.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Next, Check the python version.
python2 -V
Output:
root@vps:~# python2 -V
Python 2.7.18rc1
Done!