Install Python 2.7 on Ubuntu 20.04
In 20.04 LTS, the python included in the base system is Python 3.8. Python 2.7 has been moved to universe and is not included by default in any new installs.
Remaining packages in Ubuntu which require Python 2.7 have been updated to use /usr/bin/python2 as their interpreter, and /usr/bin/python is not present by default on any new installs. On systems upgraded from previous releases, /usr/bin/python will continue to point to python2 for compatibility. Users who require /usr/bin/python for compatibility on newly-installed systems are encouraged to install the python-is-python3 package, for a /usr/bin/python pointing to python3 instead.
Maintenance period unknown. Will OS EOL be maintained?
# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
# apt update; apt install -y python
...Abbreviation
# which python{,2,3}
/usr/bin/python
/usr/bin/python2
# ll /usr/bin/python*
lrwxrwxrwx. 1 root root 7 Apr 15 10:45 /usr/bin/python -> python2*
lrwxrwxrwx. 1 root root 9 Mar 13 12:31 /usr/bin/python2 -> python2.7*
-rwxr-xr-x. 1 root root 3694632 Apr 7 12:05 /usr/bin/python2.7*
# python -V
Python 2.7.18rc1
# apt show python
Package: python
State: not a real package (virtual)
N: Can't select candidate version from package python as it has no candidate
N: Can't select versions from package 'python' as it is purely virtual
N: No packages found
# apt show python2
Package: python2
Version: 2.7.17-2ubuntu4
Priority: optional
Section: universe/python
Source: python-defaults
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Matthias Klose <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 139 kB
Provides: python-ctypes, python-email, python-importlib, python-profiler, python-wsgiref
Pre-Depends: python2-minimal (= 2.7.17-2ubuntu4)
Depends: python2.7 (>= 2.7.17~rc1-1~), libpython2-stdlib (= 2.7.17-2ubuntu4)
Suggests: python2-doc (= 2.7.17-2ubuntu4), python-tk (>= 2.7.17~rc1-1~)
Conflicts: python-central (<< 0.5.5)
Breaks: python (<< 2.7.15-2), update-manager-core (<< 0.200.5-2)
Replaces: python (<< 2.7.15-2), python-dev (<< 2.6.5-2)
Homepage: https://www.python.org/
Task: ubuntustudio-desktop-core, ubuntustudio-desktop
Download-Size: 26.5 kB
APT-Manual-Installed: no
APT-Sources: http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
Description: interactive high-level object-oriented language (Python2 version)
# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
# apt update; apt install -y python2
...Abbreviation
# which python{,2,3}
/usr/bin/python2
# ll /usr/bin/python*
lrwxrwxrwx. 1 root root 9 Mar 13 12:31 /usr/bin/python2 -> python2.7*
-rwxr-xr-x. 1 root root 3694632 Apr 7 12:05 /usr/bin/python2.7*
# python2 -V
Python 2.7.18rc1
# apt show python2
Package: python2
Version: 2.7.17-2ubuntu4
Priority: optional
Section: universe/python
Source: python-defaults
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Matthias Klose <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 139 kB
Provides: python-ctypes, python-email, python-importlib, python-profiler, python-wsgiref
Pre-Depends: python2-minimal (= 2.7.17-2ubuntu4)
Depends: python2.7 (>= 2.7.17~rc1-1~), libpython2-stdlib (= 2.7.17-2ubuntu4)
Suggests: python2-doc (= 2.7.17-2ubuntu4), python-tk (>= 2.7.17~rc1-1~)
Conflicts: python-central (<< 0.5.5)
Breaks: python (<< 2.7.15-2), update-manager-core (<< 0.200.5-2)
Replaces: python (<< 2.7.15-2), python-dev (<< 2.6.5-2)
Homepage: https://www.python.org/
Task: ubuntustudio-desktop-core, ubuntustudio-desktop
Download-Size: 26.5 kB
APT-Manual-Installed: yes
APT-Sources: http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
Description: interactive high-level object-oriented language (Python2 version)
Recommended Posts