On 27Aug2016 09:06, Alex Kleider <aklei...@sonic.net> wrote:
On 2016-08-26 21:58, Ben Finney wrote:
Alex Kleider <aklei...@sonic.net> writes:
Am I to assume that if I have activated a virtualenv, then the
following shebang
#!/usr/bin/env python
will use the python specified in the venv/bin/?

Yes, the purpose of that shebang is to tell the OS that *whichever*
‘python’ command is found first, is the one to use.

Thanks for clarifying.
It was only after poking around and experimenting that I discovered that what the virtualenv activate command actually does is place its bin directory at the beginning of the PYTHONPATH environment variable- something I've no where seen explicitly documented.

Shouldn't that be $PATH? It does this so that running "python" will find the virtulenv "python" command ahead of others, which is its design requirement. The venv "python" then does essentially the same thing internally with sys.path to achieve the same effect for python module imports.

Cheers,
Cameron Simpson <c...@zip.com.au>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to