新聞中心

Mac上如何安裝python3?
·安裝homebrew
在終端執(zhí)行命令
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
執(zhí)行完成后,homebrew和pip等工具就自動安裝好了。
相關(guān)推薦:《Python教程》
·接下來安裝python3.在終端執(zhí)行命令:
brew install python
執(zhí)行完成后可以在的系統(tǒng)目錄:/usr/local/Cellar/python中看到python的安裝版本。
注意:在 /usr/bin/ 目錄中的python是系統(tǒng)預(yù)裝的python
此時,如果你希望在終端中輸入 python 直接使用的是你新安裝的python3。那么需要配置一下環(huán)境變量,指定一下python只用版本就行了。
·配置如下:
export PATH=${PATH}:/usr/local/Cellar/python/3.7.3/bin
alias python="/usr/local/Cellar/python/3.7.3/bin/python3"
alias pip="/usr/local/Cellar/python/3.7.3/bin/pip3"
推薦看原文:http://tryenough.com/python_install
解釋一下:
第一行指定python3全局環(huán)境變量 第二行為python命令重命名 第三行為pip命令重命名
此時就安裝好并配置好了python3。
mac上使用python推薦閱讀:
怎么在mac上使用python
mac怎么執(zhí)行python文件?
網(wǎng)頁名稱:創(chuàng)新互聯(lián)Python教程:mac上如何安裝python3
網(wǎng)站鏈接:http://m.fisionsoft.com.cn/article/cdjesss.html


咨詢
建站咨詢
