繁体   English   中英

尝试使用brew安装Python3

[英]Trying to install Python3 using brew

尝试使用以下命令在mac中安装Python3:

brew install python3

当我运行命令得到以下错误:

Error: python 2.7.14_2 is already installed
To upgrade to 3.6.5, run `brew upgrade python`

如何在没有升级的情况下将python2和python3保存在mac中...

谢谢!

Homebrew假设python公式为Python 3.因此公式python3python的别名。

你需要:

  1. brew upgrade python错误消息告诉brew upgrade python 它会将默认的Homebrew Python从2切换到3。
  2. brew install python@2 它将与Python 3一起安装Python 2。

但请注意,即使安装了Python 3(使用名为python的公式),命令python仍然指向Python 2.您需要输入python3来运行Python 3,或者在$PATH的开头添加Homebrew的Python 3前缀bin目录。 $PATH

export PATH="$(brew --prefix python)/libexec/bin:$PATH"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM