#!/usr/bin/env python vs. #!/usr/bin/python

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri May 2 21:52:21 EDT 2008


En Fri, 02 May 2008 12:07:55 -0300, D'Arcy J.M. Cain <darcy at druid.net>  
escribió:
> On Sat, 03 May 2008 00:43:02 +1000
> Ben Finney <bignose+hates-spam at benfinney.id.au> wrote:
>> Roy Smith <roy at panix.com> writes:

>> > Have you ever shipped software to a customer?
>>
>> Yes, and all parties have been quite happy with the results.
>
> When some of us talk about shipping software we aren't talking about a
> 20 line script delivered to our uncle's construction company office.  We
> are talking about millions of lines of code in thousands of programs and
> modules that has to run out of the box on whatever system the client
> happens to run on.
> [...]
> Simple for your 20 line single script.  Not so simple for my million
> line, integrated system that has to work everywhere.

In that case you have a setup script, I presume. You use distutils or a  
better alternative, I presume. You use the scripts= argument to setup, or  
the install_scripts distutils command, I presume. The first line on your  
scripts starts with #! and contains the word python somewhere, I presume.  
Then, distutils will adjust that shebang line using the same python  
executable that was used to run the installation.
It doesn't matter whether the line read #!/usr/bin/python, #!/usr/bin/env  
python, #~/bin/python2.3 or just #!python: whatever Python was used to  
install your program, that will be written as the first line on the  
script, and consequentely that will be used to execute the script in the  
future. So the admin (or whoever installs the system) only has to make  
sure to use the right Python version from the right directory. That's all.  
Plain easy, isn't it?

I can't believe some angry responses in this thread - it's just a  
technical question, not about which is the best team in the [preferred  
sports here] National Championship...

-- 
Gabriel Genellina




More information about the Python-list mailing list