From 555bf89b387046adb0a8bec6c31b935bbce7e079 Mon Sep 17 00:00:00 2001 From: FishAlchemist <48265002+FishAlchemist@users.noreply.github.com> Date: Wed, 19 Feb 2025 01:45:58 +0800 Subject: [PATCH] Add document for specifying Python interpreter in tool installation and upgrade commands. (#11598) ## Summary Just to add the section for installing and upgrading uv tool, specifying the Python version, in the document. Originally, it was planned to add a markdown block (header) for representation, but it was felt to be a bit redundant, so it ended up being like this. close https://github.com/astral-sh/uv/issues/11536 ## Test Plan Run doc server with strict mode in local. (``mkdocs serve -f mkdocs.public.yml --strict``) ![image](https://github.com/user-attachments/assets/9da66a8b-5423-4937-bc66-ea696ad1ab88) --------- Signed-off-by: FishAlchemist <48265002+FishAlchemist@users.noreply.github.com> Co-authored-by: Zanie Blue --- docs/guides/tools.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/guides/tools.md b/docs/guides/tools.md index 9b128cdc0..a72ef1979 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -237,6 +237,33 @@ To instead upgrade all tools: $ uv tool upgrade --all ``` +## Requesting Python versions + +By default, uv will use your default Python interpreter (the first it finds) when when running, +installing, or upgrading tools. You can specify the Python interpreter to use with the `--python` +option. + +For example, to request a specific Python version when running a tool: + +```console +$ uvx --python 3.10 ruff +``` + +Or, when installing a tool: + +```console +$ uv tool install --python 3.10 ruff +``` + +Or, when upgrading a tool: + +```console +$ uv tool upgrade --python 3.10 ruff +``` + +For more details on requesting Python versions, see the +[Python version](../concepts/python-versions.md#requesting-a-version) concept page.. + ## Next steps To learn more about managing tools with uv, see the [Tools concept](../concepts/tools.md) page and