superpollo wrote: > Adrian Dziubek wrote: >> The recommended Debian way is update-alternatives. I find it a bit >> unintuitive, so I have to read through the documentation every time I >> use it, but it should be able link a chosen version of python to /usr/ >> bin/python. I don't know if it's set up by default, I have only one >> version installed. >> -- >> Adrian > > what i was asking for is about a way to *INSTALL* and mantain different > python versions, a task i think is not unusal for developers. > > thanks anyway for reply > > bye
Installing several minor versions (e.g. 2.3, 2.4, 2.5, 3.0) in parallel has always been supported. Just install them and it should work "automagically". However changing the system's default /usr/bin/python is NOT recommended, especially in linux systems that rely heavily on python for many of the system tools. If you install from source, you need to check for some settings to ensure the installer does not install the /usr/bin/python's symlink. If you install from a package manager, they usually doesn't change the symlink and you'll need to run a separate program to change the symlinks (e.g. python-updater in Gentoo, which will also updates all installed python packages to the appropriate version. Neat.). The easiest way to make a specific script use a specific version of python is by changing its hashbang (#!) line: instead of: #!/usr/bin/env python use #!/usr/bin/env python2.3 or whatever version it should run on. AFAIK, no major linux distributions have officially ported to python 3.x. This means switching /usr/bin/python to python3.1 will definitely break your system. As an alternative, you can always explicitly specify the version number of python you want to use: $ python2.5 Python 2.5.4 (r254:67916, Jul 5 2009, 04:12:16) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> exit() $ python2.6 Python 2.6.2 (r262:71600, Jul 5 2009, 04:08:11) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> exit() $ python3.0 Python 3.0.1 (r301:69556, Jul 5 2009, 04:03:20) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> exit() $ python3.0 need3.py happily running with python 3.0 $ python2 need3.py SillyError: not running with python 3.0 -- http://mail.python.org/mailman/listinfo/python-list