Home > Blockchain >  How to set pip config for virtual environments?
How to set pip config for virtual environments?

Time:04-29

I want to use pip config set global.extra-index-url www.example.com but just for my virtual environment rather than the system-wide pip.

When I run the aforementioned command, it edits system-wide pip.conf file. So every time I run pip install <package> after that, even outside of a virtual environment, it checks www.example.com for packages.

Ideally, I want it to only check that extra index URL when I install packages in a given virtual environment and nowhere else.

I know that I am able to manually place a pip.conf file in the virtual environment directory to do it. But I want to know if there's a command I can run via pip to configure the pip.conf file without manually editing and placing it there.

CodePudding user response:

Add in the --site flag:

pip config set --site global.extra-index-url ...
  • Related