Touch-ups to the Python installation guide (#5133)

This commit is contained in:
Zanie Blue 2024-07-17 10:28:55 -04:00 committed by GitHub
parent eb35c05b89
commit b1501e64e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,6 @@
# Installing Python
uv can manage Python installations — Python does not need to be installed to use uv.
If Python is already installed, uv should [detect and use](#using-an-existing-python-installation) it without configuration. However, uv can also install and manage Python versions.
To install Python:
@ -10,6 +10,9 @@ $ uv python install
This will install a uv-managed Python version even if there is already a Python installation on the system.
<!-- TODO(zanieb): Restore when Python shim management is added
Note that when an automatic Python installation occurs, the `python` command will not be added to the shell. Use `uv python install-shim` to ensure the `python` shim is installed.
Once Python is installed, it can be invoked via `python`:
```console
@ -17,6 +20,9 @@ $ python --version
```
To prevent uv from managing Python system-wide, provide the `--no-shim` option during installation.
-->
Once Python is installed, it will be used by `uv` commands.
## Installing a specific version
@ -54,12 +60,12 @@ Even if a specific Python version is not requested, uv will download the latest
$ uv venv --python-preference only-managed
```
<!-- TODO(zanieb): Restore when Python shim management is added
Note that when an automatic Python installation occurs, the `python` command will not be added to the shell. Use `uv python install-shim` to ensure the `python` shim is installed.
-->
## Using an existing Python installation
uv will also use an existing Python installation if already present on the system. There's no configuration necessary for this behavior, uv will use the system Python if it satisfies the requirements of the command invocation.
uv will also use an existing Python installation if already present on the system. There's no configuration necessary for this behavior: uv will use the system Python if it satisfies the requirements of the command invocation. See the [Python discovery](../python-versions.md#discovery-order) documentation for details.
To force uv to use the system Python, provide the `--python-preference only-system` option.
See the [Python version preference](../python-versions.md#adjusting-python-version-preferences) documentation for more details.
To force uv to use the system Python, provide the `--python-preference only-system` option. See the [Python version preference](../python-versions.md#adjusting-python-version-preferences) documentation for more details.