更新时间:2023-01-14 22:10:43
Homebrew假定python
公式为Python3.因此,公式python3
是python
的别名.
The python
formula is assumed by Homebrew to be Python 3. The formula python3
is thus an alias for python
.
您需要:
brew upgrade python
,如错误消息所示.它将默认的Homebrew Python从2切换到3.brew install python@2
.它将同时安装Python 2和Python 3.brew upgrade python
, as told by the error message. It will switch your default Homebrew Python from 2 to 3.brew install python@2
. It will install Python 2 alongside Python 3.但是请注意,即使安装了Python 3(使用称为python
的公式),命令python
仍指向Python2.您需要键入python3
来运行Python 3,或添加Homebrew的Python 3 开头的未前缀bin
目录$PATH
:
Note however that even with Python 3 installed (using the formula called python
), the command python
still points to Python 2. You need to either type python3
to run Python 3, or add Homebrew’s Python 3 unprefixed bin
directory at the beginning of your $PATH
:
export PATH="$(brew --prefix python)/libexec/bin:$PATH"