1.Virtual environments and Python version management
A virtual environment isolates a project's installed packages. A Python version manager goes one level further, isolating the interpreter itself, so one project can use 3.10 while another uses 3.13 on the same machine.
Key features
- python -m venv .venv creates a package-isolated environment using whichever Python ran it
- A venv does NOT change the Python version — it inherits the one that created it
- A version manager installs and switches between multiple interpreter versions on a machine
- uv python install 3.12 (or pyenv install 3.12) fetches a specific interpreter version
- requires-python in pyproject.toml documents supported versions, but does not install one
- Version manager — which interpreter exists at all
- uv python install 3.12 — fetches an interpreter build
- Python 3.10, 3.12, 3.14 — multiple versions, side by side
- Virtual environment — which packages, for one project
- uv venv --python 3.12 — inherits the chosen interpreter
- .venv/ — isolated packages, this project only
Command
# venv: isolates PACKAGES for one Python version
python -m venv .venv
# version management: isolates the PYTHON VERSION itself
uv python install 3.12
uv venv --python 3.12A venv isolates packages, inheriting whatever Python ran it; a version manager isolates the interpreter itself.