pip-config
Configure pip settings
TLDR
List all configuration values
Show configuration files and their values
Set the value for a command option
Get the value for a command option
Unset the value for a command option
Edit the configuration file with the default editor
Edit the configuration file with a specific editor
SYNOPSIS
pip config [OPTIONS] COMMAND [ARGS]
PARAMETERS
COMMAND
Specifies the configuration action to perform. Common commands include list, get, set, unset, and edit.
-h, --help
Show a help message for the pip config command or its subcommands.
--editor
Specifies the text editor to use when the edit command is invoked. For example, --editor nano.
--global
Targets the system-wide (global) configuration file, typically found in /etc/pip.conf or similar locations.
--user
Targets the user-specific configuration file, commonly located in ~/.config/pip/pip.conf or %APPDATA%\pip\pip.ini.
--site
Targets the configuration file specific to the current Python virtual environment, if one is active.
list
Displays all configuration items currently active, showing their values and source files.
get
Retrieves and prints the value for a specific configuration key, such as global.index-url.
set
Sets a configuration key to a specified value. By default, this modifies the user configuration file.
unset
Removes a configuration key from the target configuration file. By default, this targets the user configuration file.
edit
Opens the designated configuration file in a text editor for manual modification. The file opened depends on the scope options (--global, --user, --site).
DESCRIPTION
The pip config command provides an interface for managing pip's configuration files. It allows users to inspect, modify, and delete configuration settings that control pip's behavior, such as index URLs, proxy settings, or installation options. These settings can be stored in multiple locations: globally (system-wide), per user, or specific to a Python virtual environment.
pip config helps users avoid repetitive command-line options by persistently storing their preferences. It supports listing all current settings, retrieving specific values, setting new values, unsetting existing ones, and opening configuration files directly in an editor. This command is an essential tool for customizing pip's operations to suit different development environments or network configurations, providing a standardized way to manage installation behaviors.
CAVEATS
The command is invoked as pip config, not pip-config. While the prompt referred to 'pip-config', it is a subcommand of the pip utility.
When using set or unset without explicitly specifying --global, --user, or --site, the change typically defaults to the user-specific configuration file.
Manual editing of configuration files using the edit command should be done with caution, as syntax errors can lead to unexpected pip behavior or failures.
CONFIGURATION FILE LOCATIONS
The specific locations where pip looks for configuration files vary by operating system and scope:
Global (system-wide): Often /etc/pip.conf or /usr/local/etc/pip.conf on Unix/macOS, or a pip.ini within the system-wide Python installation directory on Windows.
User-specific: Typically ~/.config/pip/pip.conf or ~/.pip/pip.conf on Unix/macOS, and %APPDATA%\pip\pip.ini on Windows.
Virtual environment: Found at $VIRTUAL_ENV/pip.conf or $VIRTUAL_ENV/etc/pip.conf if a virtual environment is active.
PRECEDENCE OF CONFIGURATION SETTINGS
pip applies configuration settings from various sources in a specific hierarchical order, with later sources overriding earlier ones:
1. Global (system-wide) configuration file.
2. Per-user configuration file.
3. Virtual environment specific configuration file.
4. Environment variables (e.g., PIP_INDEX_URL).
5. Command-line options (e.g., --index-url).
This order ensures that the most specific setting takes precedence, allowing for fine-grained control.
HISTORY
The pip config subcommand was introduced to provide a more consistent and programmatic way to manage pip's settings across different environments. Prior to its inclusion, users often had to manually locate and edit INI-style configuration files (e.g., pip.ini or pip.conf). This command streamlined the process, reducing potential errors and offering a unified interface for configuration management, reflecting pip's evolution towards more robust and user-friendly tools.
SEE ALSO
pip(1), python(1), virtualenv(1)


