Mac 安裝Python3

ZY_FlyWay發表於2018-01-17

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.

>>> 



相關文章