1.安装Python 3
从官网下载:https://www.python.org/getit/python
2.查看Python3 安装路径
打开终端,输入which python3,查看路径 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3vim
3.打开配置文件
vim ~/.bash_profilebash
4.写入外部环境变量
export PATH=${PATH}:/Library/Frameworks/Python.framework/Versions/3.7/bin/python3code
5.重命名Python
alias python="/Library/Frameworks/Python.framework/Versions/3.7/bin/python3"orm
6.关闭文件get
7.终端执行命令:it
source ~/.bash_profile
8.终端执行命令: python检查Python版本io
python Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>