About Restricting Pip Installations to Virtual Environments Only

Edit ~/.zshenv within zsh shell or ~/.bash_profile within bash shell and add a line to restrict pip installations only to virtual environments:

export PIP_REQUIRE_VIRTUALENV=true

Then if you try to install anything globally, you will get an error:

Could not find an activated virtualenv (required).

This saves you from polluting the global scope by accident.

Tips and Tricks Programming Development Python 3 Bash Zsh