Lesson 39 / 47
Virtual Environments & pip
Isolate each project's dependencies and manage packages with pip.
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.