Skip to main content

MacOS安装python3

安装 homebrew#

homebrew 是 mac 的包管理工具,使用 homebrew 可以安装和管理各种套件

在终端粘贴以下命令 来安装 homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装 python3#

mac 系统自带 python2.7

  • 查看当前的 python 版本
python --version
  • 使用 homebrew 安装 python3
brew install python3
  • 安装安装成功后输入
python3 --version

返回 Python 3.6.3 可以看到 python3 已经安装成功

使用 python 访问系统自带的2.7版本 , 使用 python3 访问新装 python3 版本