Comment on page
Preventing global package install with `PIP_REQUIRE_VIRTUALENV`
Posted on 05 Nov, 2021
To make sure you have an virtual env activated whenever you do
pip install, add the following line to your
If you now try to install packages outside a virtual environment
pipwill remind you.
$ pip install django
ERROR: Could not find an activated virtualenv (required).
In some cases you will need to install global packages (like vim plugins etc). For that create a separate bash function like this
PIP_REQUIRE_VIRTUALENV=false pip "$@"