Update docs on how to use `UV_PROJECT_ENVIRONMENT` to use the system python environment (#10817)

## Summary

The docs did mention that you could set the `UV_PROJECT_ENVIRONMENT`
variable to point Uv to use the system Python environment (e.g. for use
in CI or Docker), but it did not document _how_.

Reference:
https://github.com/astral-sh/uv/pull/6834#issuecomment-2319253359

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
Niklas Rosenstein 2025-01-21 19:40:01 +01:00 committed by GitHub
parent 399086d28f
commit 5ecfc3d900
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -172,6 +172,16 @@ This option can be used to write to the system Python environment, though it is
`uv sync` will remove extraneous packages from the environment by default and, as such, may leave `uv sync` will remove extraneous packages from the environment by default and, as such, may leave
the system in a broken state. the system in a broken state.
To target the system environment, set `UV_PROJECT_ENVIRONMENT` to the prefix of the Python
installation. For example, on Debian-based systems, this is usually `/usr/local`:
```console
$ python -c "import sysconfig; print(sysconfig.get_config_var('prefix'))"
/usr/local
```
To target this environment, you'd export `UV_PROJECT_ENVIRONMENT=/usr/local`.
!!! important !!! important
If an absolute path is provided and the setting is used across multiple projects, the If an absolute path is provided and the setting is used across multiple projects, the