You can use pyenv
to install python with:
brew install pyenv
pyenv install 2.7.18
Optionally set it to your global default:
pyenv global 2.7.18
Nice article on why using pyenv
is better than using brew
to manage your python installation.
To make python
binary available globally, add shims to PATH:
PATH=$(pyenv root)/shims:$PATH