pip --user by default

Thomas Jollans tjol at tjol.eu
Sat Jan 13 07:54:25 EST 2018


Hi,

I recently discovered the wonders of pip.conf: if I create a file
~/.config/pip/pip.conf* with:

[install]
user = true

then pip will install to the --user site-packages by default, rather
than trying to install packages into system directories.

The trouble is that this fails when you also use virtualenvs. In a
virtualenv, --user doesn't work, so pip fails when trying to install
anything in a virtualenv as long as the user pip.conf contains those lines.

Short of adding a pip.conf to every single virtualenv, is there any way
to work around this, and configure pip to install packages

 - into the user directories if possible
 - into the environment when in an environment

by default?

Thanks,
Thomas



* the path obviously depends on the OS:
https://pip.pypa.io/en/stable/user_guide/#config-file



More information about the Python-list mailing list