筆者從今天開(kāi)始進(jìn)行Python3的學(xué)習(xí),先從Python3的環(huán)境搭建開(kāi)始锭沟。
Python3在Mac上的安裝:
Mac系統(tǒng)默認(rèn)的Python版本號(hào)是2.7,由于Python3不向下兼容抽兆,所以我們需要重新安裝Python3。
兩種安裝方式:
1族淮、從 https://www.python.org 官網(wǎng)下載 Python3的安裝包辫红,雙擊安裝。
2祝辣、用 Homebrew 安裝贴妻。
筆者使用了后者進(jìn)行安裝。
brew install python3
提示如下:
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/python3-3.6.3.high_sierra.b
######################################################################## 100.0%
==> Pouring python3-3.6.3.high_sierra.bottle.tar.gz
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks
看到提示蝙斜,首先想到的是權(quán)限問(wèn)題:
所以依靠經(jīng)驗(yàn)名惩,改成如下:
sudo brew install python3
終端提示如下:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
意思是說(shuō) Homebrew 不允許使用sudo命令
經(jīng)過(guò)google,找到了解決辦法:
sudo mkdir /usr/local/Frameworks
sudo chown $(whoami):admin /usr/local/Frameworks
至此孕荠,Python3總算安裝到Mac上了娩鹉,接下來(lái)開(kāi)始配置開(kāi)發(fā)環(huán)境了,請(qǐng)看下篇稚伍。