One of the problems I encountered working with Brew, was how to select which versions of Python are used when I
installed a virtual environment. You can check which versions you currently have on your system by executing
brew info <desired forumla>. As you can see in my example, I have 3.5.1, 3.5.2, 3.6.0, and 3.6.1 on my system. You
will also notice that version 3.6.1 is starred as the currently selected version.
➜ ~ brew info python3
python3: stable 3.6.1 (bottled), HEAD
Interpreted, interactive, object-oriented programming language
/usr/local/Cellar/python3/3.5.1 (3,628 files, 53.6MB)
Poured from bottle on 2016-05-29 at 22:21:58
/usr/local/Cellar/python3/3.5.2_1 (3,571 files, 54.7MB)
Poured from bottle on 2016-08-08 at 21:48:40
/usr/local/Cellar/python3/3.5.2_3 (3,686 files, 55.4MB)
Poured from bottle on 2016-11-12 at 21:33:29
/usr/local/Cellar/python3/3.6.0 (3,704 files, 57.5MB)
Poured from bottle on 2017-02-25 at 20:16:45
/usr/local/Cellar/python3/3.6.1 (3,778 files, 57.5MB) *
Poured from bottle on 2017-04-08 at 00:22:46
mkvirtualenv <env name> will install the starred version. But what if I’m working on a project that uses an
older version of Python? If you have the version that you want in your cellar, then you can use
brew switch <formula> <version>.
➜ ~ brew switch python3 3.5.1
23 links created for /usr/local/Cellar/python3/3.5.1
Here you can see that I successfully switched to version 3.5.1. When I enter
brew info python3 again, it now shows that my starred version is indeed 3.5.1.