python --version
回车看看是什么版本python3 --version
回车,看看是否有这个版本如果有这个版本,那么恭喜你,不用安装了
brew is not defined
,那么祝贺你了,那就继续安装 brewsudo /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
一行一行复制回车(注意了!!!!)
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
# 从本镜像下载安装脚本并安装 Homebrew / Linuxbrew
git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install
/bin/bash brew-install/install.sh
rm -rf brew-install
#也可从 GitHub 获取官方安装脚本安装 Homebrew / Linuxbrew
/bin/bash -c "$(curl -fsSL https://github.com/Homebrew/install/raw/master/install.sh)"
https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/ 清华镜像官方帮助文档
brew search python
回车brew install python3
回车which python3
回车一定要根据第六步的路径配置
export PATH=${PATH}:/usr/local/bin/python3
alias pip="/usr/local/bin/python3"
alias python="/usr/local/bin/python3"
source ~/.bashrc
python --version
回车,看看是否出现3.x的版本