Update documentation for activating virtual environments in different shell (#11000)

## Add activation commands for fish shell and other alternative shells

While trying to use uv with fish shell, I encountered an issue as
`source .venv/bin/activate` didn't work. The documentation didn't
specify that fish shell requires using `source .venv/bin/activate.fish`
instead. I created issue #10986 to address this.

This PR improves the documentation by:
- Adding the correct activation command for fish shell: `source
.venv/bin/activate.fish`
- Adding the correct activation command for Nushell: `use
.venv\Scripts\activate.nu`
- Adding the correct activation command for Tcsh: `use
.venv/bin/activate.csh`

This will help users of alternative shells to properly activate their
virtual environments without encountering the same confusion I
experienced.

Fixes #10986

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
Cédric 2025-01-27 20:24:47 +01:00 committed by GitHub
parent 3c6aee30fc
commit 315fc1792a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 24 additions and 0 deletions

View File

@ -57,6 +57,30 @@ The virtual environment can be "activated" to make its packages available:
$ .venv\Scripts\activate $ .venv\Scripts\activate
``` ```
!!! note
The default activation script on Unix is for POSIX compliant shells like `sh`, `bash`, or `zsh`.
There are additional activation scripts for common alternative shells.
=== "fish"
```console
$ source .venv/bin/activate.fish
```
=== "csh / tcsh"
```console
$ source .venv/bin/activate.csh
```
=== "Nushell"
```console
$ use .venv\Scripts\activate.nu
```
## Using arbitrary Python environments ## Using arbitrary Python environments
Since uv has no dependency on Python, it can install into virtual environments other than its own. Since uv has no dependency on Python, it can install into virtual environments other than its own.