1.Xcode 安装
2.安装Homebrew,官方网址
3.安装Python3
brew install python3
安装的python3放在哪里呢,其实是在/usr/local/Cellar/这个目录下,我们打开看看 输入open /usr/local/Cellar/
$ which python #python 2.7
$ which pyhton3 #python 3.n
4.python 版本切换
Mac启动的时候会加载系统配置文件,默认命令的路径会被配置文件中的路径覆盖,并且是后面的覆盖前面的。想切换版本,只需要在.zshrc文件的最后把路径export进去就可以啦
export PATH="/usr/local/bin:$PATH"
网友评论