Overview
uv can detect and use existing Python installations, but it can also install and manage Python versions for you. Python is automatically downloaded when needed — you don’t need to install it first.Python doesn’t publish official distributable binaries. uv uses distributions from Astral’s
python-build-standalone project. See Python distributions for details.Getting started
Use the installed Python
uv automatically uses installed versions:By default, uv only installs versioned executables (e.g.,
python3.13).Installing specific versions
Install any Python version you need:python install documentation for all options.
Viewing Python installations
List available and installed Python versions:- Installed versions (uv-managed and system)
- Available versions for download
- Version details (implementation, architecture)
python list for more details.
Automatic Python downloads
Python is downloaded automatically when needed:Using existing Python versions
uv automatically discovers and uses system Python installations. No configuration needed!Force system Python
Prevent uv from using managed Python versions:Pinning Python versions
In projects
The.python-version file pins the Python version for a project:
With pyenv compatibility
uv respects.python-version files created by pyenv:
Upgrading Python versions
Upgrade to the latest supported patch release:python upgrade documentation.
Reinstalling Python
Reinstall uv-managed Python versions:- Fixing corrupted installations
- Getting improvements to Python distributions
- Resolving platform-specific issues
Improvements are constantly added to Python distributions, so reinstalling may resolve bugs even if the version number doesn’t change.
Switching Python versions
In projects
For specific commands
Use--python to override the Python version:
Working with multiple Python versions
Install all versions you need
Test across versions
Build with specific versions
Complete workflow examples
Setting up a new project
Migrating to a newer Python version
Working with PyPy
Best practices
Pin Python versions in projects
Pin Python versions in projects
Always create a This ensures all team members use the same Python version.
.python-version file in your project:Specify requires-python in pyproject.toml
Specify requires-python in pyproject.toml
Set minimum Python version in your project metadata:This documents compatibility and prevents installation on older Python.
Keep Python versions updated
Keep Python versions updated
Regularly upgrade to latest patch releases:Patch releases include security fixes and bug improvements.
Test across Python versions
Test across Python versions
Install and test with multiple Python versions:Use CI/CD to automate testing across versions.
Troubleshooting
Python version not found
Python version not found
Install the specific version:Or list available versions:
Wrong Python version used
Wrong Python version used
Check version resolution:Override with
--python:Automatic downloads not working
Automatic downloads not working
Check if automatic downloads are disabled:Or explicitly install:
Environment issues after Python upgrade
Environment issues after Python upgrade
Recreate the virtual environment:Virtual environments are tied to specific Python installations.
Next steps
Python versions concept
Deep dive into Python version management
Command reference
View all uv python commands
Running scripts
Execute Python scripts with uv
Working with projects
Create and manage projects