Config File Locator

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.

  1. PIP_CONFIG_FILE

    Highest priority

    Applies when you explicitly choose a config file.

    Config file location
    $PIP_CONFIG_FILE
    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.
    Commands
    vi "$PIP_CONFIG_FILE"
  2. Site level

    Second priority

    Applies to one virtual environment or Python installation.

    Config file location
    $VIRTUAL_ENV/pip.conf
    Used when a virtual environment is active.
    <Python installation>/pip.conf
    Used outside a virtual environment. Run pip config debug to find the exact path.
    Commands
    python -m pip config --site edit
  3. User level

    Third priority

    Applies to your user account.

    Config file location
    $XDG_CONFIG_HOME/pip/pip.conf
    Used when XDG_CONFIG_HOME is set.
    $HOME/.config/pip/pip.conf
    Default current user file.
    $HOME/.pip/pip.conf
    Legacy user file. The current user file overrides values from this file.
    Commands
    python -m pip config --user edit
  4. Global level

    Fourth priority

    Applies to every user of this pip installation.

    Config file location
    <XDG_CONFIG_DIRS entry>/pip/pip.conf
    pip checks the pip subdirectory of each configured path.
    /etc/pip.conf
    Loaded after the XDG global files.
    Commands
    python -m pip config --global edit

Inspect configuration
python -m pip config debug

Official pip documentation