pip completion

Usage

python -m pip completion [options]
py -m pip completion [options]

Description

A helper command to be used for command completion.

Options

-b, --bash

Emit completion code for bash

(environment variable: PIP_BASH)

-z, --zsh

Emit completion code for zsh

(environment variable: PIP_ZSH)

-f, --fish

Emit completion code for fish

(environment variable: PIP_FISH)

-p, --powershell

Emit completion code for powershell

(environment variable: PIP_POWERSHELL)

Example Setups

Enable pip tab completion in your shell:

Add the following line to your ~/.bashrc:

echo 'eval "$(python -m pip completion --bash)"' >> ~/.bashrc

Then reload your shell or run source ~/.bashrc to enable it immediately.

Add the following line to your ~/.zshrc:

echo 'eval "$(python -m pip completion --zsh)"' >> ~/.zshrc

Reload your shell or run source ~/.zshrc.

Add the following line to your PowerShell profile:

python -m pip completion --powershell | Out-String | Invoke-Expression

Restart your PowerShell session for the changes to take effect.

Note

On Windows, pip.exe may point to a specific Python installation (e.g. C:\Users\<user>\AppData\Local\Programs\Python\Python313\python.exe -m pip). In this case, tab completion works for that exact command. To enable completion for the pip command itself in PowerShell, you can use Register-ArgumentCompleter with CommandName pip.