Mac系统默认安装一个Python2.7版本的python解析器。这个解析器的作用一般都是为系统服务用的。如果可以自己安装python2和python3的话,在后面的开发过程中可以随意搞,这样也减小系统出现问题的可能
Python2的安装
由于Python2已经在2020/01/01的时候官方停止了后续更新,所以在Homebrew中也删掉了Python2的下载安装服务
因此在GitHub上找了一个教程,如下,测试是好用的
Installation
Add the tap to homebrew:
·brew tap matt-chapman/python2
Install as usual:
·brew install python@2
Because the binary bottles are no longer hosted by Homebrew, the formula will build from source.
Uninstallation
To uninstall:
·brew uninstall python@2
To remove this tap:
·brew untap matt-chapman/python2
安装成功后在重新启动Terminal,输入python或者python2,查看是否是新Python
Python3的安装
brew install python3
如果是最新版本的homebrew,安装的是Python3.7 Homebrew安装Python3.8有一些复杂的