§ 2.9section 17 of 18·~4 min
Modules, pip and virtual environments
import loads code from a module. Python ships with many useful ones, like csv, json, datetime and os. Everything else you install with pip.
from datetime import date
import os
print(date.today()) # e.g. 2026-10-04
print(os.getenv("DB_HOST")) # read config from the environment
One environment per project
python -m venv .venv # create an isolated environment
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install pandas # install into it
pip freeze > requirements.txt # record exact versions
on the job Keeping each project in its own virtual environment stops package versions from clashing. requirements.txt lets a teammate, or a server, rebuild exactly the same setup.