Quick Python 8: Virtual Environments

June 12, 2021

In this video, we learn how to create, manage, and remove Python Virtual Environments.

Here's a link to the source code.

Quick Tips


python3 -m venv <path>

Creates a virutal environment located at


source <path>/bin/activate

Activates a virtual environment


Deactivates a virutal environment

Bonus: Bash Alias for Quick Switching

Paste this function into your

file and restart your shell. It assumes you keep your virtual environments in the

venv() {
source ~/venv/$1/bin/activate

Switch to the venv with

venv <NAME>
and get out of it by typing


python3 -m venv ~/venv/my-env
venv my-env
# do stuff in your environment. When done:

If you liked this video, check out the whole Quick Python series and be sure to sign up using the form below to get notified of new posts! Thanks for checking this one out.