How to fix "python installation is corrupted"?

My problem turned out to be solely due to an altered /usr/bin/python symlink as suggested in the error message. I was using update-alternatives with /usr/bin/python so it was pointing to /etc/alternatives/python. Turned out that do-release-upgrade is really strict with this symlink and merely selecting python2.7 with update-alternatives isn't enough, so I ended up forcing it to its original state:

sudo ln -sf /usr/bin/python2.7 /usr/bin/python

And that solved the problem.

If this doesn't work for you, then I guess you have a genuinely corrupted python install. I'd suggest

sudo apt-get install --reinstall python

this one is correct:

sudo update-alternatives --remove-all python
sudo ln -sf /usr/bin/python2.7 /usr/bin/python

In Ubuntu 18.10 there is still the same issue.

The /usr/bin/python is linked to an older version. Even later than 2.7 are available but this super-smart process is asking (in 18.10!) for P 2.7. So I gave it and it was accepted.

This solved it for me:

1) delete /usr/bin/python doing sudo rm /usr/bin/python

2) Create a new link sudo ln -sf /usr/bin/python2.7 /usr/bin/python

In 18.10 I could NOT use sudo update-alternatives --remove-all python or sudo apt-get install --reinstall python .

Works for me. Hope it helps you, too.

Tags:

Python

Upgrade