Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: eryksun Newsgroups: comp.lang.python Subject: Re: What meaning is of '#!python'? Date: Sat, 14 Nov 2015 23:57:47 -0600 Lines: 30 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de LuwC3BZic2+aunFz5d3nHgNCN/0AT4okm7QUvx9CAvEw== 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; 'received:209.85.223': 0.03; 'configure': 0.04; 'defaults': 0.05; 'key.': 0.07; '"python"': 0.09; 'path.': 0.09; 'python",': 0.09; 'python': 0.10; '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:': 0.16; 'platforms': 0.18; 'variable': 0.18; 'windows': 0.20; '2015': 0.20; 'extension': 0.20; 'to:name :python-list@python.org': 0.20; '2.x': 0.22; '3.x': 0.22; 'keys': 0.22; 'python"': 0.22; 'trying': 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:python': 0.33; 'though.': 0.33; 'windows.': 0.33; 'file': 0.34; 'received:google.com': 0.35; 'configured': 0.35; 'nov': 0.35; 'path': 0.35; "isn't": 0.35; 'instead': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'setting': 0.37; 'virtual': 0.38; 'version': 0.38; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'some': 0.40; 'url:3': 0.60; '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:from:date:message-id:subject:to :content-type; bh=gmka3Wn5dgRr73U0ldv6x5TtWwdEJ93kdfuqoACZcOs=; b=BljRFTO18B3strWHybZev0nkZY0epCHWvlpMhR6qx3Hxp6tGP8+Nkpfzp4qh525Z1y vH0b0Kw8F7A7nyuvUjgkISAckhXD8uDaWMzPxtbhXY6Fy9UPHLT+Ybz49r0/LSXd06nV e9hGy7j1wpF7269H4QtbZ+5h2JxiMj0HCZSJURjzu6oNyytbuEhpYf+v76fXN6wRM1/i R2okjivTimmJb8HXLi1nkZKxyt+bHJzOpnfRA2ARJvurfItXbVajiQNAxLESBtUmSIhM W9QD6t7uNQvOOAoevMxv6aYpa4+aGC+gaEVZFYJpFufBy+tBQXsvKwxlzQbKyR99nGbn KajA== X-Received: by 10.107.164.227 with SMTP id d96mr26375608ioj.73.1447567107111; Sat, 14 Nov 2015 21:58:27 -0800 (PST) In-Reply-To: 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:98852 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