Lesson 41 / 49
Virtual Environments & pip
Isolate project dependencies with virtual environments and manage packages with pip and requirements.txt.
Why isolate?
A virtual environment gives a project its own private set of installed packages, separate from your system Python.
python3 -m venv .venv
source .venv/bin/activate
pip install requests pandas
pip freeze > requirements.txt
pip install -r requirements.txt # on another machineWhat to commit
Always commit requirements.txt, never the .venv folder itself — it's large and machine-specific.