Trying to install Python3 using brew Trying to install Python3 using brew python-3.x python-3.x

Trying to install Python3 using brew


The python formula is assumed by Homebrew to be Python 3. The formula python3 is thus an alias for python.

You need to:

  1. brew upgrade python, as told by the error message. It will switch your default Homebrew Python from 2 to 3.
  2. brew install python@2. It will install Python 2 alongside Python 3.

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"