python配置环境变量

使用homebrew安装
brew install python3
 
brew linkapps python3
 
将其设置为默认python,可选
cmd命令打开vi ~/.bash_profile进行修改
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
# PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
PATH="/usr/local/bin:${PATH}"
export PATH
PATH=”/usr/local/Cellar/python/3.6.4_4/bin:${PATH}”
export PATH
alias python="/usr/local/Cellar/python/3.6.4_4/bin/python3.6"
 
cmd命令:
source ~/.bash_profile
添加zsh配置文件:
HenrydeMacBook% vim ~/.zshrc
HenrydeMacBook% cat ~/.zshrc
source ~/.bash_profile
 
不设置为默认直接输入 python3也可

猜你喜欢

转载自www.cnblogs.com/TomBombadil/p/10995280.html