how to build with 2.4 having 2.6 as main python

Benjamin Kaplan benjamin.kaplan at case.edu
Tue Jun 15 19:26:06 EDT 2010


On Tue, Jun 15, 2010 at 3:55 PM, Dan Stromberg <drsalists at 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. 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?

If you care what version of Python you get, then do
#!/usr/bin/env python2.6


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. 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). This is what Ubuntu
does if you install multiple versions through the package manager.
Lucid has 2.6 (system default) and 3.1. Karmic has 2.4, 2.5, 2.6
(system), and 3.1. /usr/bin/python and /usr/bin/env python always
point to the system version, the other versions are specified through
/usr/bin/pythonX.X



More information about the Python-list mailing list