2

I have an old VM that started out as Ubuntu 16.x then I upgraded it to the 18x series and now 20.x series. I was surprised that python 2.7 was still the system python.

I discovered that if you upgrade from 18x to 20x the system python is NOT changed. Why is Python 2.7 still the default Python version in Ubuntu? On fresh install of Ubuntu 20.x python 3.x is the default.

What is the correct procedure to remove python 2.7 from an upgraded system?

2 Answers2

2

Yeah, it is strange that Ubuntu still supports python2. I've had that problem on a brand new Ubuntu 20.04 with a python3 app that had /usr/env/python in its header.

Installing sudo apt install python-is-python3solved the issue.

But don`t uninstall python2. Some scripts still might use it!

Python2 is dead. I loved it, but times changes. So @LinuxSurfaceNut pointed into the right direction...

kanehekili
  • 7,426
1

Python alone will run python v2, to run Python 3 do the following:

python3 -V

If you get nothing try upgrading:

sudo apt update
sudo apt -y upgrade

Then install pip

sudo apt install -y python3-pip

Then check version again

python3 -V

If you want python to run Python 3, you can do that using this guide: How to make 'python' program command execute Python 3?