Managing Multiple Versions of Python

September 13, 2018

This seems about right. Since I’m currently taking the AI4R course, I find myself having to switch between Python 2 and Python 3 on a daily basis. Since I’m on a Mac, that means I also have the version of Python that came with it (which I never use).

I manage most of my installs with Homebrew, so that solves getting the latest and greatest Python 3, but how to I manage the multiple versions I need to use?

You can do some Googling and get lots of choices.

I just use Conda to do it for me.

First, install Conda. I’ll do it from Homebrew, obviously.

brew cask install anaconda

From there, I can create different environments for the different versions of Python I need to use. I’ll create one named “ai4r” and choose to install Python 2.7 for that environment.

conda create -n ai4r python=2.7

There you have it. I now have a separate environment with the specific Python version I need for the course. I just have to switch to it whenever I need it.

source activate ai4r

And when I need to change it back, I can just activate the “base” environment:

source activate base


I'd like to send you a weekly recap of all the articles I write as well as my take on the latest news on web development with Vue, React, Elixir/Phoenix, and others. Just fill out your email and name below!

Next: Visual Studio Code for Python