How to change the version of python from 3.8 to 2.7

I need to use Python 2.7 in order to use PneumoCaT as it only runs with Python 2.7 not higher versions. I am trying to set my Python version from 3.8 to 2.7 in Ubuntu, but I can't do it.

This is the code I am using.

  1. ls /bin/python*

    I have /bin/python2.7 and /bin/python3.8

  1. python --version comes up with Python 3.8.

  2. sudo update-alternatives --config python

    I can choose from python 2 and 3. I chose python2.

  3. Results of python --version still comes up with Python 3.8.


python-is-python2 is a convenience package which ships a symlink to point /usr/bin/python interpreter at the current default python2. It may improve compatibility with obsolete third-party software, while breaking some modern software.

The current default Python 3 version in Ubuntu 20.04 is Python 3.8.10. To install python-is-python2 in Ubuntu 20.04 and later open the terminal and type:

sudo apt update
sudo apt install python-is-python2