pip3 : command not found
Jon Ribbens
jon+usenet at unequivocal.eu
Sun Nov 6 01:27:10 EDT 2016
On 2016-11-06, Chris Angelico <rosuav at gmail.com> wrote:
> On Sun, Nov 6, 2016 at 3:03 PM, Jon Ribbens <jon+usenet at unequivocal.eu> wrote:
>> I don't suppose anyone else more constructive and informed actually
>> knows the answer to my rather simple question of how Python knows
>> it's in a venv? ;-)
>
> Two ways.
>
> 1) Normally, you 'activate' the venv by sourcing a script into your
> shell. This modifies $PATH, $PYTHONHOME, and I think a couple of other
> environment variables.
It sets VIRTUAL_ENV, adds the virtualenv's bin directory to PATH,
and *unsets* PYTHONHOME if set. That's it (modulo storing old values
of variables and updating PS1 which is presumably just cosmetic).
> 2) If Python notices that its executable comes from a venv, it uses it.
Yes. My question is *how does it notice*?
More information about the Python-list
mailing list