I already had python3 installed(via miniconda3) and needed to install python2 alongside in that case brew install python
won't install python2, so you would need
brew install python@2
.
Now alias python2
refers to python2.x from /usr/bin/python
and alias python3
refers to python3.x from /Users/ishandutta2007/miniconda3/bin/python
and alias python
refers to python3 by default.
Now to use python
as alias for python2, I added the following to .bashrc
file
alias python='/usr/bin/python'
.
To go back to python3 as default just remove this line when required.