Python3 – How to Fix ‘Your python3 install is corrupted’ Error

16.04do-release-upgradepython3upgrade

I want to upgrade from Ubuntu 16.04.5 LTS to 18.04, so ran sudo do-release-upgrade.
After downloading and extracting bionic.tar.gz I get:

Can not upgrade 

Your python3 install is corrupted. Please fix the '/usr/bin/python3'
symlink.

I saw How to fix "python installation is corrupted"? and so I did sudo ln -sf /usr/bin/python3.6 /usr/bin/python3 thinking that it would be a similar problem. But that didn't work (still same error message).

I have a few python versions:

$ ls /usr/lib | grep python
python2.7
python3
python3.5
python3.6

$ update-alternatives --display python3
python3 - auto mode
  link best version is /usr/bin/python3.6
  link currently points to /usr/bin/python3.6
  link python3 is /usr/bin/python3
/usr/bin/python3.5 - priority 1
/usr/bin/python3.6 - priority 2

How do I fix python3?

Best Answer

You need to use the default Python 3 version for 16.04. That's 3.5, not 3.6. So run:

sudo ln -sf /usr/bin/python3.5 /usr/bin/python3

If that doesn't work, try reinstalling the python3 package.

sudo apt-get install --reinstall python3

By the way, update-alternatives --display python3 should give you update-alternatives: error: no alternatives for python3. Different versions of Python are not alternatives in Ubuntu.

Related Question