Mac 安装Python3

转载地址:https://cloud.tencent.com/developer/article/1383398

 

Mac默认是集成Python 环境的,一般是2版本。你可以在终端输入命令看一下:

zhangyudeiMac:~ zhangyu$ python

Python 2.7.10 (default, Jul 15 2017, 17:16:57) 

[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> 

我们想要安装下python3有两种方法安装:

一、第一种直接去官网下载安装: https://www.python.org/downloads/mac-osx/,有些人感觉这样装有点不能装逼。重点说下brew安装吧,

二、homebrew 安装,如果你是使用Mac的程序员,一定知道这个吧,本人很喜欢。如果不知道点这里傻瓜式教学安装

Homebrew安装Python3详细步骤指令:

1、执行  brew search python

==> Searching local taps...

app-engine-python   gst-python          micropython         python3

boost-python        ipython             python              wxpython

boost-python@1.59   ipython@5           python-markdown     zpython

==> Searching taps on GitHub...

caskroom/cask/awips-python               caskroom/cask/mysql-connector-python

caskroom/cask/kk7ds-python-runtime

==> Searching blacklisted, migrated and deleted formulae..

2、这时候看到python3了,然后执行  brew install python3

如果成功你会看到最后几行:

They will install into the site-package directory

  /usr/local/lib/python3.6/site-packages

See: https://docs.brew.sh/Homebrew-and-Python.html

==> Summary

��  /usr/local/Cellar/python3/3.6.4_2: 3,593 files, 56.2MB

/usr/local/Cellar/python3/3.6.4_2  这是路径,你可以打开看下:

3、这时候安装完成了,你可以在终端输入 python3和 python,然后你就会发现你同时拥有了2,3版本。

zhangyudeiMac:~ zhangyu$ python3

Python 3.6.4 (default, Jan  6 2018, 11:51:59) 

[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> 

zhangyudeiMac:~ zhangyu$ python

Python 2.7.10 (default, Jul 15 2017, 17:16:57) 

[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> 

posted @ 2019-06-26 17:42  黒貓  阅读(453)  评论(0编辑  收藏  举报