Other _ Change the version number of Python open in Mac system terminal

Source: Internet
Author: User

System: Mac

Python version: 2.7\3.5\3.6

Reason for demand:

python2.7 (default) installed on your computer, execute python command to open

Work needs to be installed python3.5, execution Python3 can command to open

Later installed Anaconda, Python3 start changed to 3.6 version, want to use python3.5 will have to execute python3.5 *.py, python3 by default is 3.6 Version, some headaches

Workaround:

Open ' ~/.bash_profile ', add "Alias" in front of the version that needs to be opened by default,save the file, restart the terminal, successfully

When you run Python, the python3.5 is turned on , and the other python2.7/python3.5/python3.6 commands still work.

Example: Alias path= "/library/frameworks/python.framework/versions/3.5/bin:${path}"

Reference :

https://www.zhihu.com/question/30941329/answer/51489517

Other _ Change the version number of Python open in Mac system terminal

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.