uv python is the command group in uv that installs, lists, finds, pins, upgrades and uninstalls Python versions.[1] The core commands are uv python install 3.12 to download a version, uv python list to see what is available, uv python find to print the path of the interpreter uv would use, uv python pin 3.12 to write a .python-version file, and uv python uninstall 3.12 to remove one.[1][2] You do not have to install anything first, because uv downloads a missing Python on demand by default.[1] This guide covers each command with examples, a reference table, and the edge cases that cause most confusion.
What uv python does
uv separates Python installations into two kinds. A managed installation is one uv installed itself. Everything else is a system installation, including Pythons from your operating system and ones managed by other tools. A Python managed by pyenv counts as a system Python to uv.[2]
Python does not publish official distributable binaries, so uv downloads distributions from Astral's python-build-standalone project for CPython. PyPy builds come from the PyPy project.[1][2] uv's docs describe these distributions as self-contained and highly portable. They contrast that with building from source, as pyenv does, which requires preinstalled system dependencies, and note that creating optimized builds (with PGO and LTO enabled) is very slow.[2]
Install a Python version
With no argument, uv python install installs the latest Python version. With an argument, it accepts the same request formats as the --python flag on other commands.[1][2]
# latest Python
uv python install
# a minor version (resolves to the latest patch uv knows about)
uv python install 3.12
# an exact patch, several versions at once, or a constraint
uv python install 3.12.3
uv python install 3.11 3.12
uv python install '>=3.8,=3.11'
By default, list hides downloads for other platforms and old patch versions.[2] find prints the path to the first available executable and understands the same request formats.[2] Use uv python dir to print the managed installation directory, and add --bin to print the executable directory instead.[3]
Pin, upgrade and uninstall
uv python pin 3.12 writes a .python-version file in the current directory, and uv python pin --global writes one in the user configuration directory.[2] The CLI reference also lists --rm and --resolved options for pin.[3]
Upgrades work on patch releases only. uv python upgrade 3.12 moves a managed 3.12 to the latest supported patch, and uv python upgrade with no argument upgrades all managed versions. uv does not upgrade across minor versions, such as 3.12 to 3.13, because that can change dependency resolution.[2] Upgrades are not supported for PyPy, GraalPy or Pyodide.[2]
uv python upgrade 3.12 # one minor series
uv python upgrade # every managed version
uv python install --reinstall # reinstall all installed versions
uv python uninstall 3.12
uv python uninstall --all
After an upgrade, uv keeps the old patch because existing virtual environments may still use it. Environments that follow a minor version are upgraded automatically, but one created with an explicit patch, like uv venv -p 3.10.8, stays where it is.[2] The mechanism is a minor-version directory, a symlink on Unix or a junction on Windows, that points at a specific patch.[2] If another tool resolves that link and builds a virtual environment from the resolved path, the environment will not auto-upgrade.[2]
Command and flag reference
Bookmark this table. Flags and environment variables are copied from the CLI reference and the environment variable reference.
| Command | What it does | Useful options |
|---|
| uv python list | List the available Python installations | --only-installed, --all-versions, --all-platforms, --show-urls, --output-format[3] |
| uv python install | Download and install Python versions | --default, --force, --reinstall, --upgrade, --mirror, --install-dir, --no-bin, --no-registry[3] |
| uv python upgrade | Upgrade installed Python versions | --mirror, --install-dir, --reinstall[3] |
| uv python find | Search for a Python installation | --system, --show-version, --no-project, --script, --resolve-links[3] |
| uv python pin | Pin to a specific Python version | --global, --rm, --resolved[3] |
| uv python dir | Show the uv Python installation directory | --bin[3] |
| uv python uninstall | Uninstall Python versions | --all, --install-dir[3] |
| uv python update-shell | Ensure the Python executable directory is on PATH | none beyond the global options[3] |
| Environment variable | Effect |
|---|
| UV_PYTHON | Same as --python; a path makes uv use that interpreter for all operations[4] |
| UV_PYTHON_INSTALL_DIR | Directory for managed installations[4] |
| UV_PYTHON_BIN_DIR | Directory for links to installed managed executables[4] |
| UV_PYTHON_INSTALL_BIN | Whether to install the executable into the bin directory[4] |
| UV_PYTHON_PREFERENCE | Prefer system or managed Pythons[4] |
| UV_PYTHON_DOWNLOADS | Whether uv may download Python[4] |
| UV_PYTHON_INSTALL_MIRROR | Mirror URL replacing the python-build-standalone release host[4] |
| UV_PYTHON_DOWNLOADS_JSON_URL | Path or URL of a JSON list of installations that overrides the built-in list[4] |
| UV_PYTHON_CACHE_DIR | Cache directory for archives before installation[4] |
| UV_PYTHON_SEARCH_PATH | Overrides PATH for Python discovery[4] |
Managed vs system Python
Discovery checks, in order, managed installations in UV_PYTHON_INSTALL_DIR, then python, python3 or python3.x on PATH (or python.exe on Windows), then, on Windows only, the registry and Microsoft Store interpreters.[2] Among managed versions uv prefers newer ones first. Among system versions it takes the first compatible one, not the newest.[2] Only if nothing matches does it fall back to a managed download.[2]
The python-preference setting controls the order. The default is managed, which prefers managed Pythons over system ones, but still prefers an existing system Python over downloading a new managed one.[2]
| python-preference | Behavior | Flag equivalent |
|---|
| managed (default) | Prefer managed; use system before downloading | none |
| only-managed | Never use system Python | --managed-python |
| system | Prefer system over managed | none |
| only-system | Never use managed Python | --no-managed-python |
Source for the table: the Python versions concepts page.[2] To stop automatic downloads without changing the preference, set python-downloads to manual (the default is automatic) or pass --no-python-downloads to any command. In manual mode downloads happen only during uv python install.[2]
.python-version and requires-python
Two files steer which interpreter a project uses, and they have different jobs. .python-version is a request: uv looks for it in the working directory and each parent, then in the user-level configuration directory, and it never searches past a project or workspace boundary except for that user directory. --no-config turns file discovery off. A plain version number is recommended in it, for interoperability with other tools.[2]
requires-python in pyproject.toml is a constraint. During project commands, uv uses the first Python version compatible with it, unless a version is requested some other way, such as a .python-version file or --python.[2] Projects created by uv init include a .python-version file next to a requires-python line, for example requires-python = ">=3.11". The --bare flag skips the pin file unless you add --pin-python.[5]
PATH, --default and executables
On Unix, uv python install 3.12 places a versioned executable such as python3.12 in ~/.local/bin. If that directory is not on PATH, uv python update-shell adds it.[2] uv installs only the versioned name by default. To also get python and python3, add the experimental --default option.[1][2]
uv python install 3.12 --default
python3 --version # now resolves to the uv-managed 3.12
# an existing non-uv executable needs --force to be replaced
uv python install 3.12 --default --force
uv overwrites an existing executable only if uv manages it. A ~/.local/bin/python3.12 that uv did not create stays untouched without --force.[2] Installing 3.12.7, then 3.12.6, then 3.12.8 shows the rule: 3.12.6 does not move the python3.12 link, 3.12.8 does.[2] To skip executables entirely, use --no-bin or UV_PYTHON_INSTALL_BIN=0.[3]
On Windows, uv registers managed installs per PEP 514, so the py launcher can select them, for example py -V:Astral/CPython3.13.1. Uninstalling removes the registry entry. --no-registry or UV_PYTHON_INSTALL_REGISTRY=0 skips registration.[2][3]
Offline, mirrors and frozen version lists
The list of downloadable versions is built into the uv binary and frozen per release, so a new Python can require a newer uv.[2][4] For a freshly released version such as 3.15, see our Python 3.15 migration checklist for what changes in the language itself.
For restricted networks you have four levers:
UV_PYTHON_INSTALL_MIRROR(or--mirror) replaceshttps://github.com/astral-sh/python-build-standalone/releases/download. Afile://URL reads distributions from a local directory.[4]UV_PYTHON_DOWNLOADS_JSON_URL(or--python-downloads-json-url) points uv at your own JSON list of installations, so you can change download URLs or use older or newer Pythons than the built-in list.[4]--offline(envUV_OFFLINE) is accepted by everyuv pythonsubcommand.[3]The PyPy, GraalPy and Pyodide mirrors have their own flags:
--pypy-mirror,--graalpy-mirrorand--pyodide-mirror.[3]
Variants and pre-releases
Pre-releases are not selected by default. uv uses one if no other installation matches the request, and when a pre-release is available and matches, uv will not download a stable version instead.[2] Free-threaded builds exist for CPython 3.13 and later. For 3.13 you must ask for them explicitly with 3.13t or 3.13+freethreaded. From 3.14, uv allows free-threaded interpreters without explicit selection but still prefers the GIL build when installing; +gil forces the GIL build.[2] Debug builds are requested with 3.13d or 3.13+debug. The docs say they are slower and not appropriate for general use.[2] PyPy lags CPython and currently supports versions only up to 3.11.[2]
Common mistakes
Expecting
pythonto change after install. Without--defaultonlypython3.12-style names are created.[1]Thinking pyenv Pythons are managed. uv calls them system Pythons, so
--managed-pythonignores them.[2]Expecting the newest system Python. uv takes the first compatible one on
PATH.[2]Trying to install a brand-new release on an old uv. The version list is frozen per uv release.[2]
Pinning an environment to a patch and expecting upgrades. Explicit patch requests like
-p 3.10.8do not auto-upgrade.[2]Using
uv python findin a project folder and getting the venv. It includes virtual environments by default, and.venvorVIRTUAL_ENVwins overPATH. Add--systemto skip them.[2]
Sources
Installing and managing Python, uv documentation, Astral (accessed November 30, 2026)
Python versions, uv documentation, Astral (accessed November 30, 2026)
Commands (uv python), uv documentation, Astral (accessed November 30, 2026)
Environment variables, uv documentation, Astral (accessed November 30, 2026)
5. Creating projects, uv documentation, Astral (accessed November 30, 2026)
Originally published at wowhow.cloud
Top comments (0)