Mac配置python2和3

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:
Mac配置python2和3输入python2:
Mac配置python2和3

上一篇:[leetcode 23]Merge k Sorted Lists


下一篇:Android Car - 开机画面