I am running MacOS Mojave (10.14.6) and want to install python 3.7.

Currently I have python 3.6 installed:

$ python -V
Python 3.6.9

There seems to be python 3.7 available:

$ brew search python
==> Formulae
app-engine-python            boost-python3                ipython                      python-markdown              [email protected]                   reorder-python-imports
boost-python                 gst-python                   micropython                  python-yq                    [email protected] ✔                 wxpython
==> Casks
awips-python                                              kk7ds-python-runtime                                      mysql-connector-python

If you meant "python" specifically:
It was migrated from homebrew/cask to homebrew/core.

So I tried to install python 3.7 as follows

brew install [email protected]

with a lot of output. I also executed the suggested line to have python 3.7 symlinked:

echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> /Users/me/.bash_profile

I sourced the file .bash_profile, but still python is only 3.6:

$ python -V
Python 3.6.9

I also ran the following command with an error:

$ brew switch python 3.7
Error: python does not have a version "3.7" in the Cellar.
python's installed versions: 3.7.6_1

and restarted the computer, but without success.

So how to install python 3.7 as the standard-python-installation on a mac? (Could be also python3.8 by all means).

  • Re the last line what do you mean by standard. The rest of the question implies the python found on $PATH. However the standard is the apple supplied in /usr/bin which you can't change
    – mmmmmm
    Commented Aug 18, 2020 at 12:38

4 Answers 4


Try using pyenv. This library will help you switch between different versions of Python (in case you need to run Python 2.x for some reason, and in anticipation of Python 4.0 coming).

Install pyenv

brew install pyenv

Now use pyenv to Install Python or Update Your Python Version

pyenv install 3.9.2

pyenv install 4.0.0

Check here link for more info.

  • 1
    A reason to use pyenv is choose between different sub versions e.g. 3.7 and 3.10 not just 2 and 3
    – mmmmmm
    Commented Feb 24, 2022 at 17:38
  • 1
    and can recommend pyenv virtual-env too
    – minseong
    Commented Feb 24, 2022 at 17:44

The following procedure worked for me (in addition to the commands in the original question):

brew uninstall --ignore-dependencies python3
brew uninstall --force python#3.8
brew install python3

and adding the following line to .bash_profile:

alias python="python3"

For a Mac this was really easy! Only about 10 commands.

  • 1
    For a mac that is verbose. Perhaps homebrew has issues. Macports and conda would be two lines at most
    – mmmmmm
    Commented Aug 18, 2020 at 14:42

You should be able to access version 3.7 by entering:


Depending on requirements and setup one can make adjustments to .bashrc (or bash_profile) with alias, something like:

alias python="python3.7"
alias python3="python3.6"

Of course, Python has version 3.8 out there and version 3.9 coming this fall.


Based on comment:

 brew info python
 ==> Caveats
Python has been installed as

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/[email protected]/libexec/bin


See: https://docs.brew.sh/Homebrew-and-Python

I see difference in path (libexec). This seems to be in line with comment of random guy off the internet

  • 1
    I added the aliases to the end of the file .bash_profile' and when I open a new terminal and I do python -V I get the error -bash: python3.7: command not found!!
    – Alex
    Commented Aug 18, 2020 at 14:12

You could use the Anaconda distribution of Python. Simple to install and simple to run in a virtual environment. Just run the installer at the link above. This is a very popular distribution of Python.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .