[Tutor] project directory structure

Alex Kleider akleider at sonic.net
Sun Aug 28 11:30:56 EDT 2016


On 2016-08-27 15:23, cs at zip.com.au wrote:
> 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?
Yes indeed- typing too quickly short circuiting the brain! Good that 
it's been pointed out.

> 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