pip3 : command not found

Chris Angelico rosuav at gmail.com
Sun Nov 6 00:23:22 EDT 2016


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.

2) If Python notices that its executable comes from a venv, it uses it.

(I wasn't aware of #2 until this thread.)

Generally, you type "python" or "python3" and the shell searches
$PATH. If you have a venv active, it'll find the one there before it
finds the system one.

ChrisA



More information about the Python-list mailing list