I using Ubuntu 16.04 and I currently have 3 Python versions installed: Python 2.7, 3.5 and 3.6. I have a question relating to the /etc/alternatives/python shortcut.
Here is some brief context:
ls -l /usr/bin/python* # Output: /usr/bin/python -> /etc/alternatives/python /usr/bin/python2 -> python2.7 /usr/bin/python2.7 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config /usr/bin/python2-config -> python2.7-config /usr/bin/python3 -> python3.6 /usr/bin/python3.5 /usr/bin/python3.5-config -> x86_64-linux-gnu-python3.5-config /usr/bin/python3.5m /usr/bin/python3.5m-config -> x86_64-linux-gnu-python3.5m-config /usr/bin/python3.6 /usr/bin/python3.6m /usr/bin/python3-config -> python3.5-config /usr/bin/python3m -> python3.5m /usr/bin/python3m-config -> python3.5m-config /usr/bin/python-config -> python2.7-config
I successfully mapped the "python3" shortcut (which initially open up Python 3.5) to 3.6 by typing:
sudo ln -s python3.6 python3
And my first output clearly shows this has worked. From what I understand, using the "ln -s" creates a symbolic link between the command "python3" and the /usr/bin/python3.6 so that when I type "python3", my computer knows I mean /user/bin/python3.6.
My question is: why the shortcut different for " /usr/bin/python -> /etc/alternatives/python". I have seen people use the following command to change the mapping for "python":
sudo update-alternatives --config python # My output in this case: [sudo] password for m93: There are 3 choices for the alternative python (providing /usr/bin/python). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/bin/python3.6 2 auto mode * 1 /usr/bin/python2.7 1 manual mode 2 /usr/bin/python3.5 1 manual mode 3 /usr/bin/python3.6 2 manual mode
From what I understand,this means that python 2.7 is corresponds to "python". But:
- Why is such a different way to mapping "python3"?
- what does manual vs auto mode mean?
- What do the priority levels mean?
I didn't really know what I was doing when I made this /etc/alternatives/python but I followed the instructions from this link https://unix.stackexchange.com/questions/410579/change-the-python3-default-version-in-ubuntu
Briefly, this involved: From the comment:
$ sudo update-alternatives --config python #Will show you an error: update-alternatives: error: no alternatives for python3 $ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1 $ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2 $ sudo update-alternatives --config python
However, somewhere along the line, I got confused and ended up with the output shown above. Can I just get rid of the /etc/alternatives/python?