1

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?

  • 1
    Edit your question to show us the complete output of which python and which python3 – user535733 Sep 23 '20 at 16:39
  • My python switched from default in python2 to python3. python -V; python3 -V now report the same version for both (I have to use python2 -V to get a python2 version. Using normal upgrade procedures I'd expect to have python and python3 both report the same, any failures are likely to be because of changes made by users, as clean systems (with any official packages added) will upgrade correctly I believe. Revert any changes you've made to your default python, back to default Ubuntu, and the upgrade tools will work as tested & expected. – guiverc Sep 23 '20 at 23:00

2 Answers2

1

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
  • 6,402
0

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?

SimpliFixed
  • 179
  • 7