Mac 如何让python默认运行python3.8

 

https://www.jianshu.com/p/9ce6000af3aa


Mac是自带python的,但是默认运行的是2.7

那么如何默认运行3.8呢

1.打开终端,运行该命令:open ~/.bash_profile

2.写入python外部变量环境(你python版本是多少就写多少,我的是3.8):export PATH=${PATH}:/Library/Frameworks/Python.framework/Versions/3.8/bin

3.最重要的一步,重命名python:alias python="/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8"

4.关闭文件后,在终端调用: source ~/.bash_profile

5.在终端调用 python,查看是否修改成功

posted @ 2020-07-19 16:34  阳光美美哒  阅读(1339)  评论(0编辑  收藏  举报