1.homebrew安装python3
//此处假设mac已安装brew,如未安装自行百度、google
brew install python3
2.将python3软链到/usr/local/bin
brew安装python3的路径在 /usr/local/Cellar/python/版本(这个可能不同)
执行以下命令,注意观察版本是否一致,不一致修改以下
ln -s /usr/local/Cellar/python/3.7.4_1/bin/python3 /usr/local/bin/python3
3.愉快的使用python3
zhiaiyahongdeMacBook-Pro:bin zhiaiyahong$ python3
Python 3.7.4 (default, Sep 7 2019, 18:27:02)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
python2依旧正常
zhiaiyahongdeMacBook-Pro:bin zhiaiyahong$ python
Python 2.7.10 (default, Feb 22 2019, 21:55:15)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
网友评论