Using Ubuntu 16.04
Tried to set python 3.6 as default for the python3
command. I found what seemed to be the answer and quickly copy-pasted the following lines without carefully reading:
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python (python) in auto mode
$ sudo update-alternatives --set python /usr/bin/python3.6
This is the result:
$ python3
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
$ python
Python 3.6.8 (default, Dec 24 2018, 19:24:27)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.python
A friend of mine tried to set it back like this:
$ sudo update-alternatives --install /usr/bin/python3.6 python /usr/bin/python 1
update-alternatives: renaming python link from /usr/bin/python to /usr/bin/python3.6
And this was the result:
$ python
zsh: command not found: python
And now anything linked with python 3.6 gets the error "Too many levels of symbolic links", like in this example:
$ sudo update-alternatives --config python
update-alternatives: warning: alternative /usr/bin/python (part of link group python) doesn't exist; removing from list of alternatives
update-alternatives: error: cannot stat file '/usr/bin/python3.6': Too many levels of symbolic links
The BIG problem is that if you close the terminal like like my friend did then the terminal app stops working all together. He now has to reinstall Ubuntu. And I am in the same situation, just that I still DID NOT CLOSE my terminal and (for now) everything works fine.
How can I reverse the symbolic links?