[英]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.因此公式python3
是python
的别名。
你需要:
brew upgrade python
错误消息告诉brew upgrade python
。 它会将默认的Homebrew Python从2切换到3。 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.