mac设置python3为默认版本

6,399 阅读1分钟

使用Homebrew下载python3

brew install Python3

mac一般自带python2.7 可以修改 ~/.bash_profile (具体的path取决于你的python3安装路径):

 vim ~/.bash_profile 
   # 添加这一行
   alias python="/usr/local/bin/python3"
   source ~/.bash_profile

ps:修改mac下homebrew的源 加快下载速度

把源改为清华的镜像

# HOMEBREW_BOTTLE_DOMAIN就是目标源 修改这个路径就可以里
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles'>>   ~/.bash_profile   
source ~/.bash_profile   #执行.bash_profile脚本让配置即时生效