2

I've been using Homebrew to install various packages on my Mac. Currently I have Python 2.7.13 installed via Homebrew but I'd like to upgrade to Python 3.5.x, not 3.6 which is brew's current default. At first, I just tried upgrading to Python 3:

brew install python3

Brew said "python 2.7.13 is already installed. To upgrade to 3.6.5, run brew upgrade python" which isn't the version I want.

I then tried to search to see what versions of Python brew has available:

brew search python

Now Homebrew tells me, "If you meant "python" specifically: It was migrated from caskroom/cask to homebrew/core."

I then looked at homebrew-core on Github but it doesn't appear to provide any instructions on how to do what I want to do. Does anyone know how to now display a list of Python versions that one can install using Homebrew and what command to use to install a specific version?

Jim
  • 11,270
  • 21
  • 86
  • 134
  • Possible duplicate of [Homebrew install specific version of formula?](https://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula) – Rohlex32 May 01 '18 at 20:05

2 Answers2

2

There are several discussions of this, here and elsewhere. There is no direct way to do what you want. The recommended approach is to install pyenv via brew, and use pyenv to manage the different versions of Python on your system. The github repo has a very detailed and clear guide on usage: https://github.com/pyenv/pyenv

diek
  • 436
  • 5
  • 14
-4

To see the version of python use python --version, and for upgrade use sudo apt-get upgrade python. I used this, and it's worked