1.下载python最新版本
🔗链接:https://www.python.org/downloads/mac-osx/
安装默认位置为: /Library/Frameworks/Python.framework/Versions/3.x/
2.打开终端,修改~/.bash_profile文件,命令:
touch ~/.bash_profile; open ~/.bash_profile
添加代码如下:
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.x/bin:${PATH}"
export PATH
alias python="/Library/Frameworks/Python.framework/Versions/3.x/bin/python3.x"
3.重启终端或执行命令: source ~/.bash_profile