1、首先到Python官网,点击Download Python 3.7.0
按钮。
2、进入到这个页面,点击下载对应的mac版本,下载成功后直接根据提示安装。
// 移除python2
sudo mv /usr/bin/python /usr/bin/python2
=> Password (让你输入你mac的密码)
// 查看python3安装路径
which python3
=> /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
// 建立软链接
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 /usr/bin/python
// 查看python版本
python -V
=> Python 3.7.2
python
=> Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
=> [Clang 6.0 (clang-600.0.57)] on darwin
=> Type "help", "copyright", "credits" or "license" for more information.
=> >>>
4、就这么简单,python2.7升级到python3.7大功告成。