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


Groups > comp.lang.python > #85974

Re: Python path on windows

Date 2015-02-20 09:51 -0500
From Dave Angel <davea@davea.name>
Subject Re: Python path on windows
References <f8c8a373-16e9-41c1-9e5b-37003f7a6c70@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.18923.1424443933.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 02/20/2015 09:43 AM, loial wrote:
> On Linux we use
> #!/usr/bin/env python
>
> At the start of scripts to ensure that the python executable used is the one defined in the PATH variable, rather than hardcoding a path to the python executable.
>
> What is the equivalent functionality in Windows?
>

Depends on Python version.  In newer versions, there is a py.exe file 
which they put on their path.  Then in the registry is a two-stage 
association between the .py and .pyw extensions and the above executable.

Finally, when py.exe starts, it reads that first (shebang) line, and 
decides which python interpreter to actually use.

One problem I've heard about is that if someone installs 2.7 on top of 
3.x, it can wipe out the file associations, and mess this stuff up.

The py.exe can be separately installed, to use on older python versions.

This all happened after I cut loose from Windows.

-- 
DaveA

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


Thread

Python  path on windows loial <jldunn2000@gmail.com> - 2015-02-20 06:43 -0800
  Re: Python  path on windows Dave Angel <davea@davea.name> - 2015-02-20 09:51 -0500
  Re: Python path on windows Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-20 07:54 -0700
    Re: Python path on windows loial <jldunn2000@gmail.com> - 2015-02-20 07:16 -0800
      Re: Python path on windows Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-20 11:25 -0700
      Re: Python path on windows Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-02-20 18:31 +0000
      Re: Python path on windows Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2015-02-20 21:32 +0100
  Re: Python  path on windows wxjmfauth@gmail.com - 2015-02-20 07:20 -0800
  Re: Python path on windows Gisle Vanem <gvanem@yahoo.no> - 2015-02-21 12:05 +0100
  Re: Python path on windows Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-02-21 12:36 +0000
  Re: Python path on windows Dave Angel <davea@davea.name> - 2015-02-21 09:10 -0500
  Re: Python path on windows Chris Angelico <rosuav@gmail.com> - 2015-02-22 01:40 +1100

csiph-web