homebrew 安裝 python3
可以用 homebrew 安裝,也可以官網(wǎng)下載安裝,我這里選擇使用 homebrew 安裝,沒有裝 homebrew 的小伙伴請(qǐng)自行百度
brew install python3
我們執(zhí)行下 python3 發(fā)現(xiàn)可以識(shí)別命令了
配置 python3 環(huán)境變量
先看下 python3 安裝路徑,因?yàn)槲业?homebrew 是路徑為 /opt/homebrew
小伙伴可以自己找尋自己的 homebrew 安裝的路徑哈
然后我們找到 python3 的具體安裝路徑
ls -al /opt/homebrew | grep python3
很容易知道我的 python3 的路徑是在:/opt/homebrew/Cellar/python@3.10/3.10.9/bin
于是打開 zshrc 文件把 python3 環(huán)境變量配置其中(大家注意配置自己的路徑)文章來源:http://www.zghlxwxcb.cn/news/detail-423705.html
# Python3 環(huán)境變量配置(from homebrew)
PYTHON_HOME=/opt/homebrew/Cellar/python@3.10/3.10.9
PIP_HOME=/opt/homebrew/Cellar/python@3.10/3.10.9
PATH=$PYTHON_HOME/bin:$PIP_HOME/bin:$PATH
export PYTHON_HOME
export PIP_HOME
export PATH
最后我們檢查一下文章來源地址http://www.zghlxwxcb.cn/news/detail-423705.html
which PYTHON_HOME
到了這里,關(guān)于Mac安裝python3并配置環(huán)境變量的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!