I am working on a system that has to work on both Windows and Linux. Its uses Python's venv
module for everything related to Python. I need to create a pip.conf
file to activate the pickup of my personal ~/.pip/pip.conf
to point it to our internal PyPi server instead of the global one. I also need to be able to hard code the values right into the venv
's pip.conf
for other scenarios. I can't figure out where the file should be placed.
In short, sometimes I need it to use my personal pip.conf
, sometimes I need it to use the venv
's pip.conf
, on both Linux and Windows (my machine is Windows).
The folder structure of my venv
after creation is this:
myproject/build/venv/Include
/Lib
/Scripts
Where does the pip.conf
go? I keep reading in the documentation %virtual_env%/pip.conf
but when you don't know what the value of virtual_env, its a pretty useless statement.
My guess is myproject/build/venv/pip.conf
, am I right?
edit**
Well, I was wrong. Putting it in the root of the venv
folder didn't work. I'm going to keep trying, problem is to redeploy this app after each code change takes an hour.
The easiest way to locate the folder is by running the following command in the cmd.
pip config -v list
That will result with the paths that pip is searching in to find the config file. There are different paths for global
, user
, site
. And you can even add one for you specific needs.
According to pip user guide https://pip.pypa.io/en/stable/user_guide/#config-file it's pip.ini
under Windows, not pip.conf
.
It should be at the root of your virtual environnement, right where you tried with pip.conf
, and takes precedence over your personal %APPDATA%/pip/pip.ini
.
On Windows, the configuration is stored at C:\Users\<username>\.virtualenvs\<virtual env name>\pip.ini
Ref: https://pip.pypa.io/en/stable/user_guide/#config-file
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