Python Virtual Environments are Actually Easy… (If You Don’t Make Them Complicated).

Jake Krajewski
The Startup
Published in
3 min readMar 21, 2020

--

How to set up a virtual environment: A super easy, lightweight solution to quickly and efficiently set up portable environments for your Python projects. Let’s begin.

Whoops, this is a real environment; not a virtual environment! Photo by ANGELA BENITO on Unsplash

What is a virtual environment for? Why do you need one? A virtual environment helps keep your project bundled together with a list of its dependencies. This makes it portable and easy for someone else to open your project and get it up and running without dozens of import errors. We’ll assume you know why you should have an environment but have you been digging around for a straightforward tutorial without all the fluff? Here it is.

Virtualenv

We’re going to use the virtualenv package becuase it is really easy.

  1. In terminal, navigate to your project folder. Once there, type this:
virtualenv venv

If you have Python 3.3 or greater virtualenv is included. If not, quickly google “install virtualenv <insert your OS here>” and come right back. Once you finish step one, it should have created a child folder in your project folder called venv.

2. Next, while still in the project folder, type this:

--

--

Jake Krajewski
The Startup

☧ Cognitive Science Master, Experienced digital product designer. Formerly @GoPro . Exploring the intersection of tech, startups, and a.i./deep learning