12

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

えるまる
  • 2,409
  • 3
  • 24
  • 44
abhishek phukan
  • 751
  • 1
  • 5
  • 16
  • May be duplicated with [Credentials in pip.conf for private PyPI](https://stackoverflow.com/questions/50468951/credentials-in-pip-conf-for-private-pypi) – LiuChang Aug 28 '19 at 02:54

1 Answers1

11

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

Community
  • 1
  • 1
Dinko Pehar
  • 5,454
  • 4
  • 23
  • 57