Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to set pip config for virtual environments?

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

>Solution :

Add in the --site flag:

pip config set --site global.extra-index-url ...
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading