欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

mac系統(tǒng)安裝Python3初體驗(yàn)

 更新時(shí)間:2018年01月02日 10:06:03   作者:童真的爛漫  
這篇文章主要介紹了mac系統(tǒng)安裝Python3初體驗(yàn),需要的朋友可以參考下

前沿

對(duì)于iOS開發(fā)不要隨便拆卸系統(tǒng)自帶的Python,因?yàn)橛泻芏?library 還是使用 Python2.7。

1 安裝Xcode

1.1 App Store 搜索Xcode 并安裝

1.2 安裝 Xcode command line tool

1.2.1 打開命令行terminal工具

control + space
輸入terminal
回車

1.2.2 安裝Xcode command line tool

  xcode-select --install

2 安裝套件管理工具 Homebrew

2.1 安裝 Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2.2 查看是否安裝成功

brew doctor

3 安裝Python

brew install python

4 設(shè)置路徑(可選)

如果不設(shè)置路徑,則使用python的話,會(huì)默認(rèn)用系統(tǒng)的。(這個(gè)沒有具體執(zhí)行,所以這個(gè)需要自己嘗試)

## 修改/etc/paths,把/usr/local/bin 移到上面去
sudo vim /etc/paths

拓展:
查看當(dāng)前path是什么。
PATH 的用途:
告訴系統(tǒng),我們的brew在哪里。會(huì)從上往下查找。

echo $PAHTH

5 確認(rèn)安裝

// 系統(tǒng)自帶的python2.7,目錄為/usr/bin/python
which python
//brew安裝的python3.4,目錄為/usr/local/bin/python3
which python3

6 使用

未執(zhí)行操作4的情況(推薦)

// 系統(tǒng)自帶的
python a.py
//brew安裝的
python3 a.py

執(zhí)行操作4的情況

// 系統(tǒng)自帶的
/usr/bin/python a.py
//brew安裝的
python a.py

7 安裝pip

  • 安裝Python2.7以上版本,會(huì)自動(dòng)帶pip。
  • 系統(tǒng)自帶的python沒有pip,只有easy_install
// 給系統(tǒng)的python安裝pip
easy_install pip

使用pip

// 系統(tǒng)自帶的
pip --version
//brew安裝的
pip3 --version

總結(jié)

以上所述是小編給大家介紹的mac系統(tǒng)安裝Python3初體驗(yàn),希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論