On Tue, Jun 15, 2010 at 4:26 PM, Benjamin Kaplan <benjamin.kap...@case.edu>wrote:
> On Tue, Jun 15, 2010 at 3:55 PM, Dan Stromberg <drsali...@gmail.com> > wrote: > > > > I don't think #!/usr/bin/env python is the right thing - unless a script > > really doesn't care much what version of python it gets. > > > > I used to #!/usr/bin/env everything, but I've been updating my old > scripts > > not to. It's just too much trouble, despite the one minor simplification > it > > provides. > > > > My Ubuntu 10.04 system has a mix of the two, but there are more > > #!/usr/bin/python's. That concerns me a bit, because I've needed to > install > > a half dozen versions of python in the past, and soon will do so on this > > machine. Of course, I rarely change my $PATH to include one of these > > alternative python's (which is probably the salient issue), but I don't > want > > to be stuck being unable to do so if the need does arise. > > > > I spent a year working in PowerShell, to my surprise. What a pain it was > > not being able to install more than one version at the same time. May > > Python never have that problem! > > > > > #!/usr/bin/python doesn't mean you care about what version of Python > you use, it means you care about what *location* you use. Nah. It means you want the system default. To an extent. > If I'm on > Ubuntu 8.04, it's Python 2.5. If I'm on Ubuntu 10.04, it's Python 2.6. > And what happens if you bring your script to a distribution that puts > its python installs in /usr/local/bin? > Few to none will. There was a discussion way back in Linux history about putting standard utilities in /usr/local. It was slapped down. People wanted it because their Suns and HP's had everything in /usr/local, but wisely, things were relocated to /usr. > If you care what version of Python you get, then do > #!/usr/bin/env python2.6 > That's not a bad suggestion, but I rarely put my python builds on my $PATH, and don't really see that changing (but would like to retain the ability in case I do need it). My main reason for this is that sometimes python will inspect your $PATH looking for its standard library. Or at least, it did at one time. > > which will run it under a specific version of Python. All Python > installs include the pythonX.X executable, and then one of those > executables is symlinked to python. Yes, this is a good thing to do. > Common convention on Linux and Mac > OS X (probably other Unix-based systems as well) is to leave > /usr/bin/env python pointing to the system's default Python install > (wherever it is) and to altinstall the other versions of Python (so > you access them by specifying the version number). The thing is, this doesn't really point to anything. Each user can change their $PATH variable - system scripts shouldn't break because of something so common. > This is what Ubuntu > does if you install multiple versions through the package manager. > Did you read what I posted? Ubuntu 10.04 (Lucid Lynx) is mostly using #!/usr/bin/python. /usr/bin has: 1 #!/usr/bin/envpython2.6 1 #!/usr/bin/python3 1 #!/usr/bin/python -OOt 2 #!/usr/bin/python2.6-dbg 4 #!/usr/bin/env python 12 #!/usr/bin/python2.6 14 #!/usr/bin/envpython 114 #!/usr/bin/python Lucid has 2.6 (system default) and 3.1. >
-- http://mail.python.org/mailman/listinfo/python-list