Mac 笔记本电脑系统自带的Python版本一般是Python 2.7,如果安装了Python 3.x,在终端中输入python命令后,输出的信息还是Python 2.7,问题就是如何将Mac系统默认的Python版本由Python2.x改为Python3.x呢?
操作分为三步:
1. 终端打开.bash_profile文件
open ~/.bash_profile
2. 添加别名,在文件最后面添加配置
alias python="/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7"
3.终端中重新读取.bash_profile文件
source .bash_profile
好了完工,再执行python ,现在执行的就是python 3.7了