Trying to install Python3 in mac using below command :
brew install python3
When i run the command getting below error :
Error: python 2.7.14_2 is already installed
To upgrade to 3.6.5, run `brew upgrade python`
How to keep both python2 and python3 in mac without upgrading...
Thanks!
The python
formula is assumed by Homebrew to be Python 3. The formula python3
is thus an alias for python
.
You need to:
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.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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With