赞
踩
分别下载python2.X和python3.X
将python2、3到路径添加到bash_profile中(以安装到python2和anaconda3为例,一定要填写正确到python路径)
# Setting PATH for Python 2.X
PATH="/System/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
# Setting PATH for Python 3.X
PATH="/Users/hlj/opt/anaconda3/bin:$PATH"
将python指令声明到具体路径
alias python2='/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7'
alias python3='/Users/hlj/opt/anaconda3/bin/python3.8'
alias python=python3
source ~/.bash_profile
source ~/.bashrc
完成后,控制台输入python2或python,进入python2.7环境中;输入python3,进入python3.8环境中。
致谢
https://www.cnblogs.com/dylancao/p/10234094.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。