Shebang line on Windows?

Zachary Ware zachary.ware+pylist at gmail.com
Fri Feb 22 19:40:53 CET 2013


On Fri, Feb 22, 2013 at 12:16 PM, Walter Hurry <walterhurry at lavabit.com> wrote:
> I use FreeBSD or Linux, but my son is learning Python and is using
> Windows.
>
> My question is this: Would it be good practice for him to put #!/usr/bin/
> env python at the top of his scripts, so that if made executable on *nix
> they will be OK? As I understand it this will have no effect on Windows
> itself.

Adding the shebang line on Windows would be excellent practice.  In
fact, Python 3.3 and later ships with the Python Launcher for Windows
[1] which is very effective at reading the shebang line and executing
the script with the proper Python installation.  It makes using Python
2.x and 3.x on the same Windows machine much less painful, as well as
not having to add anything to the PATH and being able to launch
whichever interpreter you want with a single command.

[1] http://docs.python.org/3/using/windows.html#python-launcher-for-windows



More information about the Python-list mailing list