Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51308

Re: Python Script Hashplings

References <51F12B41.3050004@Gmail.com> <51F12E31.1070502@mrabarnett.plus.com> <CAJqEzS2dj4UKDzHa=-OpyzJJHe5UzzMzJPB_Sc-jKa7A9PoNwg@mail.gmail.com> <51F25259.7010909@Gmail.com>
From Matthew Lefavor <mclefavor@gmail.com>
Date 2013-07-26 10:58 -0400
Subject Re: Python Script Hashplings
Newsgroups comp.lang.python
Message-ID <mailman.5151.1374850755.3114.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

>
>
> Thanks Matthew Lefavor! But specifically, why use "#!/usr/bin/env python3"
> instead of "#!/usr/bin/python3"?
>

The "env" program looks up its argument in the current $PATH environment
variable, and then executes that. This means you aren't necessarily tied to
/usr/bin/python3. It makes things more portable.

For example, old Linux distributions don't have Python 3 installed with
them, and the user might not have permissions to install Python 3
system-wide. Instead they have it in some sort of ~/HOME/bin directory, and
then that is placed on the path by their .bashrc file. If your shebang line
was "#!/usr/bin/python3", the program wouldn't work without them changing
that line. If the shebang ling was "#!/usr/bin/env python3", it would find
the Python3 binary no problem.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python Script Hashplings Matthew Lefavor <mclefavor@gmail.com> - 2013-07-26 10:58 -0400

csiph-web