abhishek phukan
abhishek phukan

Reputation: 791

Pip.conf file to use environment variable

Is it possible to have an environment variable as a part of the index url in pip.conf?

I tried using $ and ${} but it does not resolve the variables

Upvotes: 15

Views: 18104

Answers (1)

Dinko Pehar
Dinko Pehar

Reputation: 6061

You can set environment variables for pip to use instead of specifying them in pip.conf file.

Use export PIP_DEFAULT_INDEX_URL='some_url.com' to set them.

To list all config, use pip config list. They should be set.

But beware of config precedence:

--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

Upvotes: 13

Related Questions