How can I install multiple versions of Python on latest OS X and use them in parallel?

pyenv is the thing you want. It works very very well:

pyenv lets you easily switch between multiple versions of Python. It’s simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well. This project was forked from rbenv and ruby-build, and modified for Python.

https://github.com/pyenv/pyenv

Install it via Homebrew:

$ brew update
$ brew install pyenv

It handles the download, compilation, and installation of various pythons for you, e.g.:

$ pyenv install 3.7.2

It can show you which versions you’ve installed, and which is active:

$ pyenv versions
  system
  3.6.7
* 3.7.2

When you’re in a new project directory, just tell pyenv which python version to use there:

$ pyenv local 3.6.7  # Because e.g. tensorflow isn't compat. with 3.7 :-(

You can set a ‘default’ version everywhere else:

$ pyenv global 3.7.2

Leave a Comment