Setting up your Python environment with virtualenv and virtualenvwrapper on MacOS

Chanon Roy
2 min readDec 10, 2021

Virtualenv is a great tool for creating isolated Python environments that contain all the necessary dependencies for a particular project. Without them, our global environment can quickly become out of sync with what we expect for a particular project.

In today’s post, I’ll walk you through my preferred flow for setting up Python and virtual environment on a new MacOS environment.

1. Install brew 🍺

brew is a package manager for macOS. It’s awesome.

You may already have it. If you do, the following command should work

$ brew --version
Homebrew 2.2.15

If not, install it with this command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2. Install Python 🐍

With brew setup, we can now use it to install Python.

brew install python3

If everything installed correctly, you should be able to see the following:

$ which python3
/usr/local/bin/python

3. Install virtualenv and virtualenvwrapper 📦

--

--

Chanon Roy
Chanon Roy

Written by Chanon Roy

🧑🏻‍💻 I write about tech and programming. I'm also fluent in film references

No responses yet