pip config file locations
Commands use a POSIX shell (macOS, Linux, or WSL). Install the named editor or CLI first. Before using an environment-variable path, check that the variable is set to a non-empty, intended path. When using vi or Notepad, ensure the parent directory exists and is writable. A missing file is created when you save it; Notepad may ask to create it.
Higher-priority files override the same setting in lower-priority files.
PIP_CONFIG_FILE
Highest priorityApplies when you explicitly choose a config file.
Config file location
Loaded last when set. An existing file skips the user config; the OS null device disables all config files. Only edit when PIP_CONFIG_FILE points to a real configuration file, not /dev/null or NUL.$PIP_CONFIG_FILECommands
vi "$PIP_CONFIG_FILE"Site level
Second priorityApplies to one virtual environment or Python installation.
Config file location
Used when a virtual environment is active.$VIRTUAL_ENV/pip.confUsed outside a virtual environment. Run pip config debug to find the exact path.<Python installation>/pip.confCommands
python -m pip config --site editUser level
Third priorityApplies to your user account.
Config file location
Used when XDG_CONFIG_HOME is set.$XDG_CONFIG_HOME/pip/pip.confDefault current user file.$HOME/.config/pip/pip.confLegacy user file. The current user file overrides values from this file.$HOME/.pip/pip.confCommands
python -m pip config --user editGlobal level
Fourth priorityApplies to every user of this pip installation.
Config file location
pip checks the pip subdirectory of each configured path.<XDG_CONFIG_DIRS entry>/pip/pip.confLoaded after the XDG global files./etc/pip.confCommands
python -m pip config --global edit
Inspect configuration
python -m pip config debugOfficial pip documentation