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.