I got Python 2.7.8 installed on my Win7 machine, which comes with pip already pre-installed.
I\'m successfully able to install new packages from pip and now I need to add c
All the answers are partially wrong and right.
It depends on how your system is configured. The only way (for me) to find out was to patch site-packages/pip/locations.py
at the point where site_config_files
is assigned (around line 120 for pip 9.0.1)
print('########## ' + str(site_config_files))
and then run pip search foo
On my system it printed ########## ['C:\\ProgramData\\pip\\pip.ini']
, of which location I assumed I could not create/edit. But it just worked.
Btw, for my system %APPDATA% points to C:\Users\MYUSER\AppData\Roaming
, which is not looked at when running pip
on my system.
Pip changed the location of the config file in windows starting in pip 6.0 the pip config docs explain the location of the config files as follows.
%APPDATA%\pip\pip.ini
%HOME%\pip\pip.ini
%VIRTUAL_ENV%\pip.ini
C:\ProgramData\pip\pip.ini
C:\Documents and Settings\All Users\Application Data\pip\pip.ini
Also pip added a config command starting in pip 10.
pip config --help
A bit late, but for reference:
Try adding the pip.ini file in %USERPROFILE%\pip\pip.ini
(usually: C:\Users\<username>\pip\pip.ini
).
I know this is a bit late, however, this post is high on the rankings when searching. Inside a virtual environment pip.ini can also be in the root of the virtual environment. From the docs
Inside a virtualenv:
On Unix and macOS the file is $VIRTUAL_ENV/pip.conf
On Windows the file is: %VIRTUAL_ENV%\pip.ini
For me (Windows 8, pip 9.0.1, python 3.5.3), the correct path was
c:\Users\<UserName>\.pypirc <- sic!, even on windows
Rather than guessing first check if you have any default global/local config which is read by pip with the below command:
pip config list
This will give all details of the default config loaded by python.
If the above command doesn't give any output please try to find where pip tries to find for the global config file with the below command:
pip config --editor <path to editor of your choice> edit
The above command will open the config file which pip reads by default or else it will give an error saying that the file doesn't exist.
If there's an error please go ahead and create the exact directory and file structure as show in the error. Once the file has been created please make your changes e.g.
[global]
cert = /path/to/base64/ssl/certificate.pem
proxy = http://username:password@ipaddress:port
Save the file and please try to check (the above mentioned check command) if the configs are loaded by pip or not.
For more info please follow pip config documentation