Detailed description of how to switch python multiple versions on Mac

Source: Internet
Author: User
Mac comes with python2.x version, sometimes need to use python3.x version to do development, but can not delete python2.x, may cause system instability, then need to install multiple versions of Python under this article to introduce you to Mac To switch python multiple versions of the method, need to see the friends together

Mac comes with python2.x version, sometimes need to use python3.x version for development, but can not delete python2.x, may cause system instability, then you need to install multiple versions of Python.

1, install the python3.x version, I installed 3.6.1;

2, open terminal (terminal), input: sudo vi ~/.bashrc;

3. Enter and save at the top of the edit page that pops up:


Alias python2= '/library/frameworks/python.framework/versions/2.x/bin/python2.x ' Alias python3= '/Library/ frameworks/python.framework/versions/3.x/bin/python3.x '

I have Python2.7 and Python3.6 version on the machine, the above x please replace it according to the situation.

4. Restart terminal (terminal) or input: source ~/.BASHRC

5. Verify that the input Python2 in terminal (terminal) is the python2.x version, and the input python3 is the python3.x version.

Related Article

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.