[Tutor] project directory structure

cs at zip.com.au cs at zip.com.au
Sat Aug 27 18:23:49 EDT 2016


On 27Aug2016 09:06, Alex Kleider <akleider at sonic.net> wrote:
>On 2016-08-26 21:58, Ben Finney wrote:
>>Alex Kleider <akleider at 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 <cs at zip.com.au>


More information about the Tutor mailing list