Add documentation for uv python find (#6527)

In part, for https://github.com/astral-sh/uv/pull/6521
This commit is contained in:
Zanie Blue 2024-08-23 15:14:52 -05:00 committed by GitHub
parent 80b5384a4d
commit e0abab8259
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -134,6 +134,34 @@ To exclude downloads and only show installed Python versions:
$ uv python list --only-installed
```
## Finding a Python executable
To find a Python executable, use the `uv python find` command:
```console
$ uv python find
```
By default, this will display the path to the first available Python executable. See the
[discovery rules](#discovery-of-python-versions) for details about how executables are discovered.
This interface also supports many [request formats](#requesting-a-version), e.g., to find a Python
executable that has a version of 3.11 or newer:
```console
$ uv python find >=3.11
```
By default, `uv python find` will include Python versions from virtual environments. If a `.venv`
directory is found in the working directory or any of the parent directories or the `VIRTUAL_ENV`
environment variable is set, it will take precedence over any Python executables on the `PATH`.
To ignore virtual environments, use the `--system` flag:
```console
$ uv python find --system
```
## Discovery of Python versions
When searching for a Python version, the following locations are checked: