Using UV to install Python

Interesting that I can now use uv to install Python. They have a guide.

I tried it out.

$ uv python install 3.14
Installed Python 3.14.0a3 in 1.22s
 + cpython-3.14.0a3-macos-aarch64-none

You can only run the installed Python via uv.

$ uv run --python 3.14 python
Python 3.14.0a3 (main, Jan  5 2025, 06:22:51) [Clang 19.1.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

Interestingly, uv can detect Pythons installed via other mechanisms.

$ uv python list --only-installed
cpython-3.14.0a3-macos-aarch64-none    .local/share/uv/python/cpython-3.14.0a3-macos-aarch64-none/bin/python3.14
cpython-3.12.5-macos-aarch64-none      /opt/homebrew/opt/python@3.12/bin/python3.12 -> ../Frameworks/Python.framework/Versions/3.12/bin/python3.12
cpython-3.12.5-macos-aarch64-none      .asdf/installs/python/3.12.5/bin/python3.12
cpython-3.12.5-macos-aarch64-none      .asdf/installs/python/3.12.5/bin/python3 -> python3.12
cpython-3.12.5-macos-aarch64-none      .asdf/installs/python/3.12.5/bin/python -> python3.12
cpython-3.11.9-macos-aarch64-none      /opt/homebrew/opt/python@3.11/bin/python3.11 -> ../Frameworks/Python.framework/Versions/3.11/bin/python3.11
cpython-3.11.6-macos-aarch64-none      .asdf/installs/python/3.11.6/bin/python3.11
cpython-3.9.6-macos-aarch64-none       /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -> ../../Library/Frameworks/Python3.framework/Versions/3.9/bin/python3

And you can run those Python installations via uv.

$ uv run --python 3.9.6 python --version
Python 3.9.6

$ uv run --python 3.11.9 python --version
Python 3.11.9

$ uv run --python 3.12.6 python --version
Python 3.12.6

However, that last one above was not in the list. uv downloaded it on-demand and ran it. This seems to be the default behavior which can be overridden by an environment variable.

Let me uninstall and try again with a command line option which is equivalent to the environment variable.

$ uv python uninstall 3.12.6
Searching for Python versions matching: Python 3.12.6
Uninstalled Python 3.12.6 in 300ms
 - cpython-3.12.6-macos-aarch64-none

$ uv run --no-python-downloads --python 3.12.6 python --version
error: No interpreter found for Python 3.12.6 in virtual environments, managed installations, or search path
tech
Taskfile bash completion in homebrew