mac安装python3

2019-09-29  本文已影响0人  至爱雅鸿_e631

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()

参考

Python3: Command not found(Mac OS)

上一篇 下一篇

猜你喜欢

热点阅读