Jonathan Lam

EE/CS @ The Cooper Union


pip venvs and freezing

On Sun Apr 18 2021 21:52:54 GMT-0400 (Eastern Daylight Time)

Return to blog

Notes for my own reference. I don't like pip (I prefer npm with its implicit local environments and don't find any of the following command names particularly intuitive) but had to use it for a group project today.

Virtual environments:

# creating virtual environment in venv/
python -m venv venv

# activating venv
. venv/bin/activate

# deactivating venv

# destroying venv
rm -rf venv

Saving/restoring dependencies

Make sure you're in the venv when doing these.

# freezing dependencies
pip freeze >requirements.txt

# installing dependencies
pip install -r requirements.txt

© Copyright 2021 Jonathan Lam