Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.05; 'subject:Python': 0.06; 'binary': 0.07; 'python3': 0.07; 'executes': 0.09; 'permissions': 0.09; 'skip:/ 10': 0.09; 'variable,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; "wouldn't": 0.14; 'cc:addr:python.org': 0.22; 'install': 0.23; "aren't": 0.24; 'file.': 0.24; 'looks': 0.24; 'environment': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'skip:" 20': 0.27; 'header:In- Reply-To:1': 0.27; 'installed': 0.27; 'message- id:@mail.gmail.com': 0.30; 'that.': 0.31; 'directory,': 0.31; 'linux': 0.33; 'skip:& 30': 0.33; 'problem.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'changing': 0.37; 'example,': 0.37; 'skip:& 10': 0.38; 'skip:& 20': 0.39; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'tied': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=J87jDOIWPhIzetki0XNj0QW0/YXh/f/Ja5WZEPWe+WU=; b=BUc4zYokDdnyvCrN08ovrl+8L7WoQz5Ew0cpmYR7UQVW/kuPU1H0CTzjiQHrTpZH5n jyDAT+JTq8JvzdSxJ8JhgSE8+cBNlImMRfNtpqO+7PNtfBZgSQaWnQBKVCv+h4wIXGLn qvUd2oaHh27QNpQG2Dg1yr3NkIdhZIXKrSap6alIsTpZ6Xw68YmN7CXyXXCCJEvrTJrf g+IQbt61d0Ol8Qq4aOs1L2wZiDcZzDB/h1TmCccuAXCXwRYxDQDGqu+RPolaa/9zqQrx R3+8h7FYfg9I9D5LgIJxijTB+FlByU2zP1eQGgZEkxDogBgFmP5uh0EIbzZQktDqEQJ5 Z7xA== X-Received: by 10.50.67.43 with SMTP id k11mr1114216igt.26.1374850745183; Fri, 26 Jul 2013 07:59:05 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <51F25259.7010909@Gmail.com> References: <51F12B41.3050004@Gmail.com> <51F12E31.1070502@mrabarnett.plus.com> <51F25259.7010909@Gmail.com> From: Matthew Lefavor Date: Fri, 26 Jul 2013 10:58:24 -0400 Subject: Re: Python Script Hashplings To: Devyn Collier Johnson Content-Type: multipart/alternative; boundary=047d7bd76db04933eb04e26b62fb Cc: Python Mailing List X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374850755 news.xs4all.nl 15947 [2001:888:2000:d::a6]:39226 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51308 --047d7bd76db04933eb04e26b62fb Content-Type: text/plain; charset=ISO-8859-1 > > > 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. --047d7bd76db04933eb04e26b62fb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
<= div class=3D"h5">
Thanks Matthew Lefavor! But specifically, why use "#!/usr/bin/env python3" instead of "#!/usr/bin/python3"?

The "env" program looks up its argume= nt 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 Pyt= hon 3 installed with them, and the user might not have permissions to insta= ll Python 3 system-wide. Instead they have it in some sort of ~/HOME/bin di= rectory, 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.
--047d7bd76db04933eb04e26b62fb--