Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Newsgroups: comp.lang.python Subject: Re: What meaning is of '#!python'? Date: Sun, 15 Nov 2015 21:54:41 -0700 Lines: 38 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de W3BgjcxiaNJlsPP/Z4UyMwHm2uOl+5gxIrj99Hl0gH6Q== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'configure': 0.04; 'defaults': 0.05; 'key.': 0.07; 'cc:addr:python-list': 0.09; '"python"': 0.09; 'path.': 0.09; 'python",': 0.09; 'python': 0.10; 'python.': 0.11; 'subject:python': 0.14; '(but': 0.15; 'variables': 0.15; '"python",': 0.16; 'placeholder': 0.16; 'qualifying': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'registry': 0.16; 'registry.': 0.16; 'wrote:on': 0.16; 'wrote:': 0.16; '>': 0.18; 'email addr:gmail.com>': 0.18; 'platforms': 0.18; 'variable': 0.18; 'windows': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'extension': 0.20; '2.x': 0.22; '3.x': 0.22; 'keys': 0.22; 'python"': 0.22; 'trying': 0.22; 'cc:no real name:2**0': 0.22; '(or': 0.23; 'sat,': 0.23; 'unix': 0.24; 'header:In-Reply-To:1': 0.24; 'command': 0.26; 'installed': 0.26; 'skip:" 20': 0.26; 'message-id:@mail.gmail.com': 0.27; '14,': 0.27; 'specify': 0.27; 'cases.': 0.29; 'concern': 0.29; 'path,': 0.29; 'searches': 0.29; 'environment': 0.29; 'url:mailman': 0.30; 'skip:& 30': 0.30; 'url:python': 0.33; 'though.': 0.33; 'windows.': 0.33; 'url:listinfo': 0.34; 'file': 0.34; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'so,': 0.35; 'configured': 0.35; 'nov': 0.35; 'path': 0.35; 'replace': 0.35; "isn't": 0.35; 'instead': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'setting': 0.37; 'doing': 0.38; 'virtual': 0.38; 'version': 0.38; 'received:209': 0.38; 'someone': 0.38; 'url:mail': 0.40; 'some': 0.40; 'url:3': 0.60; 'from:no real name:2**0': 0.60; 'default': 0.61; 'programs': 0.62; 'skip:n 10': 0.62; 'latest': 0.64; 'ware': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=g/L9MhjCnlHMhPrkoLF9ASR7P9+/zmNp0cZ6tw6K6lA=; b=CikDc7wmR2AeTXDGyhBf9nPqd7TzLEc2bEH8k65m+wVfwHVv2VbloOX03wxDKXT0zk n+Fi8TB9M7H6/Ogbpi8PN0w5ONsko2eOFoAHe5MlcLFwhnVLZXSFGWaHF10HSMIEh0d3 2BhDQHG6yrOJsDxo55EXfX+PS1ESYMKIl2KQfVGPxjQQmNUM4zd2r0gDspnAgoBkLLav mr3Kxpbqx61LwkKy+YJU6Jq6MCGJ5KcZam5S0w3v0v7LG7QczePeExnU7DC3IS/MmViu IdrMoxFdju6tpHsSXQ+r3LCesqfZgq3q43+RYXOSoWOAvX0wMr6W+4xIrZ+xDY7vjKrb U7uw== X-Received: by 10.112.54.169 with SMTP id k9mr15652655lbp.95.1447649681458; Sun, 15 Nov 2015 20:54:41 -0800 (PST) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.20+ X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:98864 The installer of some applications will replace the shebang to refer to a specific version of Python. By doing so, it avoids problems when someone upgrades the default Python version in the PATH. On Nov 14, 2015 11:00 PM, "eryksun" wrote: > On Sat, Nov 14, 2015 at 8:26 PM, Zachary Ware > wrote: > > > > "#!python" is a valid shebang for the Python Launcher for Windows. > > It's also a not-too-terrible placeholder for a Unix shebang meaning > > "whichever Python you want it to be". The better choice for use with > > both platforms would be "#!/usr/bin/env python", though. > > The "/usr/bin/env python" virtual command searches the directories in > PATH, trying each file extension from PATHEXT such as "python.COM", > "python.EXE", and so on. You can also search for other programs such > as "pypy". Note that qualifying "python" (but not other names) as > "python2" or "python3.5" makes the launcher use the registry instead > of searching PATH. > > "#!/usr/bin/python" may be better in some cases. This defaults to the > latest installed version of 2.x (or 3.x if no 2.x is installed) that's > configured in the Windows registry. Or specify "python2" or "python3" > to use the latest 2.x or 3.x. These commands can be configured to use > a particular major[.minor[-32]] version via the environment variables > PY_PYTHON, PY_PYTHON2, and PY_PYTHON3. Or you can configure them > instead by setting the "python", "python2" and "python3" keys in the > [defaults] section of the configuration file "%LOCALAPPDATA%\py.ini". > Note that the environment variable overrides the corresponding py.ini > key. > > When portability isn't a concern you can use a Windows path in the > shebang such as "#!C:\pypy40\pypy.exe". > > https://docs.python.org/3/using/windows.html#shebang-lines > -- > https://mail.python.org/mailman/listinfo/python-list >