Python pip ini windows

Configuration#

This page explains how the configuration files and environment variables work, and how they are related to pip’s various command line options.

pip config command, which helps manage pip’s configuration.

Configuration Files#

Configuration files can change the default values for command line option. They are written using a standard INI style configuration files.

pip has 3 “levels” of configuration files:

  • global : system-wide configuration file, shared across users.
  • user : per-user configuration file.
  • site : per-environment configuration file; i.e. per-virtualenv.

Location#

pip’s configuration files are located in fairly standard locations. This location is different on different operating systems, and has some additional complexity for backwards compatibility reasons.

In a “pip” subdirectory of any of the paths set in the environment variable XDG_CONFIG_DIRS (if it exists), for example /etc/xdg/pip/pip.conf .

This will be followed by loading /etc/pip.conf .

$HOME/.config/pip/pip.conf , which respects the XDG_CONFIG_HOME environment variable.

The legacy “per-user” configuration file is also loaded, if it exists: $HOME/.pip/pip.conf .

$HOME/Library/Application Support/pip/pip.conf if directory $HOME/Library/Application Support/pip exists else $HOME/.config/pip/pip.conf

The legacy “per-user” configuration file is also loaded, if it exists: $HOME/.pip/pip.conf .

  • On Windows 7 and later: C:\ProgramData\pip\pip.ini (hidden but writeable)
  • On Windows Vista: Global configuration is not supported.
  • On Windows XP: C:\Documents and Settings\All Users\Application Data\pip\pip.ini

The legacy “per-user” configuration file is also loaded, if it exists: %HOME%\pip\pip.ini

PIP_CONFIG_FILE #

Additionally, the environment variable PIP_CONFIG_FILE can be used to specify a configuration file that’s loaded first, and whose values are overridden by the values set in the aforementioned files. Setting this to os.devnull disables the loading of all configuration files.

Loading order#

When multiple configuration files are found, pip combines them in the following order:

Each file read overrides any values read from previous files, so if the global timeout is specified in both the global file and the per-user file then the latter value will be used.

Naming#

The names of the settings are derived from the long command line option.

As an example, if you want to use a different package index ( —index-url ) and set the HTTP timeout ( —default-timeout ) to 60 seconds, your config file would look like this:

[global] timeout = 60 index-url = https://download.zope.org/ppix 

Per-command section#

Each subcommand can be configured optionally in its own section. This overrides the global setting with the same name.

Читайте также:  Фон для TR

As an example, if you want to decrease the timeout to 10 seconds when running the pip freeze , and use 60 seconds for all other commands:

[global] timeout = 60 [freeze] timeout = 10 

Boolean options#

Boolean options like —ignore-installed or —no-dependencies can be set like this:

[install] ignore-installed = true no-dependencies = yes 

To enable the boolean options —no-compile , —no-warn-script-location and —no-cache-dir , falsy values have to be used:

[global] no-cache-dir = false [install] no-compile = no no-warn-script-location = false 

Repeatable options#

For options which can be repeated like —verbose and —quiet , a non-negative integer can be used to represent the level to be specified:

[global] quiet = 0 verbose = 2 

It is possible to append values to a section within a configuration file. This is applicable to appending options like —find-links or —trusted-host , which can be written on multiple lines:

[global] find-links = http://download.example.com [install] find-links = http://mirror1.example.com http://mirror2.example.com trusted-host = mirror1.example.com mirror2.example.com 

This enables users to add additional values in the order of entry for such command line arguments.

Environment Variables#

pip’s command line options can be set with environment variables using the format PIP_ . Dashes ( — ) have to be replaced with underscores ( _ ).

PIP_FIND_LINKS="http://mirror1.example.com http://mirror2.example.com" 
--find-links=http://mirror1.example.com --find-links=http://mirror2.example.com 

Repeatable options that do not take a value (such as —verbose ) can be specified using the number of repetitions:

Environment variables set to an empty string (like with export X= on Unix) will not be treated as false. Use no , false or 0 instead.

Precedence / Override order#

Command line options override environment variables, which override the values in a configuration file. Within the configuration file, values in command-specific sections override values in the global section.

  • —host=foo overrides PIP_HOST=foo
  • PIP_HOST=foo overrides a config file with [global] host = foo
  • A command specific section in the config file [] host = bar overrides the option with same name in the [global] config file section.

Источник

Configuration#

This page explains how the configuration files and environment variables work, and how they are related to pip’s various command line options.

pip config command, which helps manage pip’s configuration.

Configuration Files#

Configuration files can change the default values for command line option. They are written using a standard INI style configuration files.

pip has 3 “levels” of configuration files:

  • global : system-wide configuration file, shared across users.
  • user : per-user configuration file.
  • site : per-environment configuration file; i.e. per-virtualenv.
Читайте также:  Sql select php var

Location#

pip’s configuration files are located in fairly standard locations. This location is different on different operating systems, and has some additional complexity for backwards compatibility reasons.

In a “pip” subdirectory of any of the paths set in the environment variable XDG_CONFIG_DIRS (if it exists), for example /etc/xdg/pip/pip.conf .

This will be followed by loading /etc/pip.conf .

$HOME/.config/pip/pip.conf , which respects the XDG_CONFIG_HOME environment variable.

The legacy “per-user” configuration file is also loaded, if it exists: $HOME/.pip/pip.conf .

$HOME/Library/Application Support/pip/pip.conf if directory $HOME/Library/Application Support/pip exists else $HOME/.config/pip/pip.conf

The legacy “per-user” configuration file is also loaded, if it exists: $HOME/.pip/pip.conf .

  • On Windows 7 and later: C:\ProgramData\pip\pip.ini (hidden but writeable)
  • On Windows Vista: Global configuration is not supported.
  • On Windows XP: C:\Documents and Settings\All Users\Application Data\pip\pip.ini

The legacy “per-user” configuration file is also loaded, if it exists: %HOME%\pip\pip.ini

PIP_CONFIG_FILE #

Additionally, the environment variable PIP_CONFIG_FILE can be used to specify a configuration file that’s loaded first, and whose values are overridden by the values set in the aforementioned files. Setting this to os.devnull disables the loading of all configuration files.

Loading order#

When multiple configuration files are found, pip combines them in the following order:

Each file read overrides any values read from previous files, so if the global timeout is specified in both the global file and the per-user file then the latter value will be used.

Naming#

The names of the settings are derived from the long command line option.

As an example, if you want to use a different package index ( —index-url ) and set the HTTP timeout ( —default-timeout ) to 60 seconds, your config file would look like this:

[global] timeout = 60 index-url = https://download.zope.org/ppix 

Per-command section#

Each subcommand can be configured optionally in its own section. This overrides the global setting with the same name.

As an example, if you want to decrease the timeout to 10 seconds when running the pip freeze , and use 60 seconds for all other commands:

[global] timeout = 60 [freeze] timeout = 10 

Boolean options#

Boolean options like —ignore-installed or —no-dependencies can be set like this:

[install] ignore-installed = true no-dependencies = yes 

To enable the boolean options —no-compile , —no-warn-script-location and —no-cache-dir , falsy values have to be used:

[global] no-cache-dir = false [install] no-compile = no no-warn-script-location = false 

Repeatable options#

For options which can be repeated like —verbose and —quiet , a non-negative integer can be used to represent the level to be specified:

[global] quiet = 0 verbose = 2 

It is possible to append values to a section within a configuration file. This is applicable to appending options like —find-links or —trusted-host , which can be written on multiple lines:

[global] find-links = http://download.example.com [install] find-links = http://mirror1.example.com http://mirror2.example.com trusted-host = mirror1.example.com mirror2.example.com 

This enables users to add additional values in the order of entry for such command line arguments.

Читайте также:  Insertion sorting in java

Environment Variables#

pip’s command line options can be set with environment variables using the format PIP_ . Dashes ( — ) have to be replaced with underscores ( _ ).

PIP_FIND_LINKS="http://mirror1.example.com http://mirror2.example.com" 
--find-links=http://mirror1.example.com --find-links=http://mirror2.example.com 

Repeatable options that do not take a value (such as —verbose ) can be specified using the number of repetitions:

Environment variables set to an empty string (like with export X= on Unix) will not be treated as false. Use no , false or 0 instead.

Precedence / Override order#

Command line options override environment variables, which override the values in a configuration file. Within the configuration file, values in command-specific sections override values in the global section.

  • —host=foo overrides PIP_HOST=foo
  • PIP_HOST=foo overrides a config file with [global] host = foo
  • A command specific section in the config file [] host = bar overrides the option with same name in the [global] config file section.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where on Windows 10 is pip.conf or pip.ini located? #4206

Where on Windows 10 is pip.conf or pip.ini located? #4206

Comments

Description:

What I’ve done: pip list

What has happened:

λ pip list DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.

What went wrong:

Nothing, but deprecation message is annoying and I can’t locate any pip.conf or pip.ini to stop it.

NOTE: Python 3 installed with Chocolatey

The text was updated successfully, but these errors were encountered:

Источник

Оцените статью