Alternatives use notes, alternatives notes

Source: Internet
Author: User

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

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.