I tried to make Python 3 the default Python version by running:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
This broke Python 2 programs, so I tried reversing the process and finally I tried:
sudo update-alternatives --install /usr/bin/python python2.7 /usr/bin/python2.7 10
which made python2.7
the default Python version but Software Updater doesn't run and running aptdcon
in a terminal gives:
bash: /usr/bin/aptdcon: /usr/bin/python3: bad interpreter: No such file or directory
I tried reinstalling Python 3 but got:
Errors were encountered while processing:
/var/cache/apt/archives/python3_3.4.0-0ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
How do I revert this mess?
I managed to solve the issue myself. The problem was the broken symlink in
/usr/bin
First I identified where python3 is. I guessed that the python3 binary would be in a similar folder as python2. So I typed
ls -l /usr/bin/python
.This gave me
/usr/bin/python -> /etc/alternatives/python2.7
.Since in
/etc/alternatives/
there was no python3, I repeated the processls -l /etc/alternatives/python2.7
gave/etc/alternatives/python2.7 -> /usr/bin/python2.7
A simple
ls /usr/bin/python3.[1-9]
listed all the python binaries available. The one I was interested in waspython3.4
.Then I simply created a symlink with
sudo ln -s /usr/bin/python3.4 /usr/bin/python3
.Problem solved.