Update Python 2.7 to latest version of 2.x

Solution 1:

Ubuntu 18.04 and newer:

The new version of Ubuntu no longer uses python 2, so you need to install it with:

sudo apt install python-minimal

Ubuntu 17.04 and older:

The answer appears to be to add a third party repository:

sudo add-apt-repository ppa:jonathonf/python-2.7
sudo apt-get update
sudo apt-get install python2.7
python --version