Ubuntu Toggle Default Python version __python

Source: Internet
Author: User

Recently learn python, because learning is python3, but the current Linux system is the default version is Python2, so Baidu a bit, find a good way.

This method is applicable to other distributions of Ubuntu and Debian without testing. The normal situation is supported by the release version of Ubuntu and Debian development

Open the terminal by entering the following two commands:

sudo update-alternatives--install/usr/bin/python python/usr/bin/python2
sudo update-alternatives--install/ Usr/bin/python Python/usr/bin/python3 150

And then enter the terminal:

Python

If correct, the Python version should now switch to the default Python3.

If you need to switch back to Python you only need to enter in the terminal:

sudo update-alternatives--config python

And then select the Python version you want, enter the serial number and return

Because many of the system's programs depend on Python2, if you need to upgrade your system or install system updates, it is recommended that you switch to the default version of the system first Python2 or you may have dependencies that cannot be installed.

View Original: https://www.aizheteng.net/ubuntu-python-version.html

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.