Sometimes by mistake, I install some packages globally with plain pip install package
and contaminate my system instead of creating a proper virtualenv and keeping things tidy.
How can I easily disable global installs with pip
at all?
Or at least show a big warning when using it this way to ensure I know what I am doing?
I can be late, but you can do it either via:
~/.pip/pip.conf
):[global]
require-virtualenv = true
env variable PIP_REQUIRE_VIRTUALENV
For pip versions >= 10.0.0b1, from the command line system-wide using:
pip config set global.require-virtualenv true
This gives you exactly what you want, example:
$ pip install foobar
ERROR: Could not find an activated virtualenv (required).