Alternatives use notes, alternatives notes
The X64 ora23 X64 system has multiple versions of python. The default version is python2.7.
$ ls -l /usr/bin/python*lrwxrwxrwx. 1 root root 24 Mar 26 15:49 /usr/bin/python -> /usr/bin/python2lrwxrwxrwx. 1 root root 9 Jun 20 2016 /usr/bin/python2 -> python2.7-rwxr-xr-x. 1 root root 7088 Jun 20 2016 /usr/bin/python2.7lrwxrwxrwx. 1 root root 9 Jun 29 2015 /usr/bin/python3 -> python3.4-rwxr-xr-x. 2 root root 11184 Jun 29 2015 /usr/bin/python3.4-rwxr-xr-x. 2 root root 11184 Jun 29 2015 /usr/bin/python3.4m-rwxr-xr-x. 1 root root 308 Jun 19 2015 /usr/bin/python3-chardetect-rwxr-xr-x. 1 root root 301 Sep 28 2015 /usr/bin/python3-coverage-rwxr-xr-x. 1 root root 301 Jun 19 2015 /usr/bin/python3-mako-render-rwxr-xr-x. 1 root root 43 Jun 19 2015 /usr/bin/python3-pyinotify
Now you want to switch to the default version of python3.4. Use the alternatives command and use alternatives -- display python to find that python is not in the management list of alternatives. Add python of different versions to alternatives and use usage: alternatives -- install <link> <name> <path> <priority>
$ alternatives --install /usr/bin/python python /usr/bin/python2.7 1$ alternatives --install /usr/bin/python python /usr/bin/python3.4 2
View alternatives -- display python
$ alternatives --display pythonpython - status is auto. link currently points to /usr/bin/python3.4/usr/bin/python2.7 - priority 1/usr/bin/python3.4 - priority 2Current `best' version is /usr/bin/python3.4.
We can see that the alternatives point to python3.4.
$ ls -l /usr/bin/python*lrwxrwxrwx. 1 root root 24 Mar 26 15:49 /usr/bin/python -> /etc/alternatives/pythonlrwxrwxrwx. 1 root root 9 Jun 20 2016 /usr/bin/python2 -> python2.7-rwxr-xr-x. 1 root root 7088 Jun 20 2016 /usr/bin/python2.7lrwxrwxrwx. 1 root root 9 Jun 29 2015 /usr/bin/python3 -> python3.4-rwxr-xr-x. 2 root root 11184 Jun 29 2015 /usr/bin/python3.4-rwxr-xr-x. 2 root root 11184 Jun 29 2015 /usr/bin/python3.4m-rwxr-xr-x. 1 root root 308 Jun 19 2015 /usr/bin/python3-chardetect-rwxr-xr-x. 1 root root 301 Sep 28 2015 /usr/bin/python3-coverage-rwxr-xr-x. 1 root root 301 Jun 19 2015 /usr/bin/python3-mako-render-rwxr-xr-x. 1 root root 43 Jun 19 2015 /usr/bin/python3-pyinotify
$ ls -l /etc/alternatives/python lrwxrwxrwx. 1 root root 18 Mar 26 15:49 /etc/alternatives/python -> /usr/bin/python3.4
Note:
Update-alternatives and alternatives are the same commands.
$ ls -l /usr/sbin/update-alternatives lrwxrwxrwx. 1 root root 12 Oct 2 2015 /usr/sbin/update-alternatives -> alternatives
[1] https://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux