MacOS 如何升级python版本

1、下载最新版

  • 官网下载python3.7 并且安装
    下载链接

2、打开终端执行指令

 open ~/.bash_profile

3、确认.bash_profile文件里是否存在以下内容,没有则添加并保存

# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
alias python="/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7"

4、终端执行指令

source ~/.bash_profile

5、确认升级,终端输入指令

[daidaideMacBook-Pro:~ a_dai$ python
Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:59:38) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

喜欢点赞,有问题请留言

你可能感兴趣的:(MacOS 如何升级python版本)