1.编辑:vi ~/.bash_profile,在末尾加上如下内容:
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
# Setting PATH for Python 3.9
PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
2、编辑:vi ~/.bashrc,添加如下内容:(⚠️python不能加System)
alias python2='/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7'
alias python3='/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9'
alias python=python3
3、让配置生效
source ~/.bash_profile
source ~/.bashrc
4、终端输入python/python3:
输入python2: