1.查看當前python3的位置
which python3
我的電腦當前地址路徑是:/usr/local/bin/python3
2.準備好環(huán)境變量的配置內(nèi)容
PATH="/usr/local/bin:${PATH}"
export PATH
alias python="/usr/local/bin/python3"
3.將內(nèi)容寫入到指定的文件里
vi ~/.bash_profile
輸入i,貼入上面準備好的內(nèi)容,然后esc,“:”,wq,就可以保存退出。
4.設(shè)置輸入python為默認的python3
執(zhí)行命令:source ~/.bash_profile
source ~/.bash_profile 這行命令添加到 ~/.zshrc 文件方法:
再執(zhí)行這個命令,寫入內(nèi)容:source ~/.bash_profile
文章來源:http://www.zghlxwxcb.cn/news/detail-518315.html
vim ~/.zshrc
再次執(zhí)行python
,顯示的就是默認的python3了文章來源地址http://www.zghlxwxcb.cn/news/detail-518315.html
到了這里,關(guān)于Mac上配置python3的環(huán)境變量的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!