Disable global installs using pip - allow only virtualenvs
<p>Sometimes by mistake I install some packages globally with plain <code>pip install package</code> and contaminate my system instead of creating a proper virtualenv and keeping things tidy.</p>

<p>How can I easily disable global installs with <code>pip</code> at all? Or at least show big fat warning when using it this way to make sure that I know what am I doing?</p>

<p>You could try creating adding something like this to your <code>.bashrc</code></p>

<pre><code>pip() {
    if [ -n "$VIRTUAL_ENV" ]; then
        # Run pip install
    else
        echo "You're not in a virtualenv"
    fi
}
</code></pre>

<p>My knowledge of bash isn't the greatest but this should put you on the right path I think.</p>

python pip virtualenv