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
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.
On Unix the file may be located in /etc/pip. conf. Alternatively it may be 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.
On Unix and macOS the file is $VIRTUAL_ENV/pip. conf. On Windows the file is: %VIRTUAL_ENV%\pip. ini.
${PIP_INDEX_URL} is expanded by the shell before passing to sudo . This is a handy shell trick and works with ssh and anything else that passing args and environment directly to a subprocess. Modify your sudo configuration in sudoers to extend the list of allowed environment variables to pass to the child.
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
overridesPIP_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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With