Does pip have autocomplete?

Pip has a long list of commands. Is there any way to use auto-complete by Tab in console (Bash)?


A reasonably current pip comes with built-in functionality to create completion helpers for bash, zsh or fish:

$ pip help completion

Usage:   pip completion [options]

Description:
  A helper command to be used for command completion.

Completion Options:
  -b, --bash                  Emit completion code for bash
  -z, --zsh                   Emit completion code for zsh
  -f, --fish                  Emit completion code for fish

You can use it like so:

pip completion --bash >> ~/.bashrc

And then start a new shell or source ~/.bashrc to have it take effect.


UPDATE: Don’t forget to look at muru’s answer which may provide a more straightforward solution.

A pip autocompletion plugin for Bash can be found at https://github.com/ekalinin/pip-bash-completion.

You can download it as a ZIP or simply install using Git:

git clone https://github.com/ekalinin/pip-bash-completion.git
sudo cp ./pip-bash-completion/pip /etc/bash_completion.d/
. /etc/bash_completion.d/pip  # to enable in the current shell, next time should load automatically