Why Ubuntu doesn’t support certain form of shebang for Python?

Neal McBurnett neal at bcn.boulder.co.us
Tue Nov 11 18:48:38 UTC 2014


On Tue, Nov 11, 2014 at 01:35:09PM -0500, Scott Kitterman wrote:
> On Tuesday, November 11, 2014 13:04:38 Rodney Dawes wrote:
> > On Tue, 2014-11-11 at 18:02 +0100, GatoLoko wrote:
> > > Since different distributions and unix systems may have different paths,
> > > you may want to use the env utility in a shebang like "#!/usr/bin/env
> > > python2".
> > 
> > Using /usr/bin/env will cause problems in certain conditions, such as
> > when running under a virtualenv and other such environments.
> > 
> > Also, for python 2.x scripts, you should always use /usr/bin/python, and
> > if python3 is required, /usr/bin/python3. There is no guarantee that
> > "python2" will be a valid command.
> 
> The problem is that one Linux distro went insane and pointed /usr/bin/python 
> at a python3 version, which is the only reason the PEP creating 
> /usr/bin/python2 exists, so thanks to them there is no common shebang one can 
> be sure will always work.  /usr/bin/python works fine everywhere but one 
> distro, so that's what I'd use too.  /usr/bin/env python{2} is fine for 
> developer oriented packages where they may want to override the default python 
> version in some contained environment, but risky for things that are part of 
> an actual system.

I'm glad that python2 is in Debian and Ubuntu (do you know offhand which releases?).
Which distros is it still not supported in?  Are they likely to catch up?

Do you see a path to a world where compliance with PEP 0394 is the right approach, making the transition to python3 easier?

  http://legacy.python.org/dev/peps/pep-0394/

Thanks,

Neal McBurnett                 http://neal.mcburnett.org/




More information about the Ubuntu-devel-discuss mailing list