Managing Python Versions
Running multiple Python versions on one machine lets you develop on the latest release, test backward compatibility, and match production interpreters exactly.
Search across all documentation pages
Running multiple Python versions on one machine lets you develop on the latest release, test backward compatibility, and match production interpreters exactly.
# uv (recommended)
uv python install 3.13 3.14
uv python pin 3.14
# pyenv (alternative)
pyenv install 3.14.0
pyenv local 3.14.0When to reach for this:
requires-python support# Install interpreters
uv python install 3.13 3.14
# Pin project to 3.14
cd myproject
uv python pin 3.14
cat .python-version # 3.14
# Test on 3.13 without changing the pin
uv run --python 3.13 pytest
# Multi-version CI matrix (GitHub Actions excerpt)strategy:
matrix:
python-version: ["3.13", "3.14"]
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e ".[dev]" && pytestWhat this demonstrates:
uv python install downloads interpreters without system package managers.python-version pins the default for a directory treeuv run --python runs a single command against another version~/.local/share/uv/python/ and symlinks on demand~/.pyenv/versions/ and shims python via PATHrequires-python in pyproject.toml declares the supported range| Tool | Install | Pin per project | Speed |
|---|---|---|---|
| uv python | uv python install | .python-version | Fast |
| pyenv | pyenv install | .python-version | Moderate |
| deadsnakes PPA | apt install python3.14 | Manual | System-wide |
| asdf | asdf install python | .tool-versions | Moderate |
# pyproject.toml - declare supported range
[project]
requires-python = ">=3.13"# tox.ini for local multi-version testing
[tox]
envlist = py313,py314.python-version not committed - teammates use different versions. Fix: commit .python-version or document in pyproject.toml.requires-python lower bound.xcode-select --install; or use uv python install (pre-built binaries).| Alternative | Use When | Don't Use When |
|---|---|---|
| Docker per version | Exact prod reproduction | Fast local iteration |
| Nix/devcontainers | Entire team identical envs | Simple single-version apps |
| System packages only | Server deployment images | Local development |
uv python is faster (pre-built binaries) and integrates with uv workflows. pyenv has broader plugin ecosystem. New projects: uv.
python --version or uv run python --version inside a project.
Only if you avoid 3.14-only syntax and APIs. Test on 3.13 explicitly.
.python-version (uv/pyenv), pyproject.toml requires-python, or .tool-versions (asdf).
Install the new version, update .python-version, update requires-python, recreate the venv, and run tests.
Yes. Libraries should test against every version in requires-python.
Install 3.14t variant with uv for no-GIL testing. Most apps still use the default build.
Yes: uv python install 3.14 in GitHub Actions without setup-python.
uv provides Windows binaries. pyenv-win is the Windows pyenv port.
uv python list or pyenv versions.
Stack versions: This page was written for Python 3.14.0, FastAPI 0.115+, Django 5.2, Flask 3.1, Pydantic 2, PyTorch 2.6+, pandas 2.2+, Polars 1.x, ruff 0.9+, and uv 0.6+.
Reviewed by Chris St. John·Last updated Jul 19, 2026