• changing global settings to python2.4.4

  last modified February 11 by mchua

why does this tutorial exist?

This is a side reference mainly intended for people going through the building openplans notes but will work for others trying to change their global python version to python2.4.4 (or another version) for other reasons as well.

Openplans must be built with python2.4.3 or python2.4.4 because of Zope. Python 2.4.4 is recommended. You can either change your settings so that your entire machine is set to use python2.4.4 (kind of destructive, but if you want to use python2.4.4 for everything else as well, you could). If you want to go this (not-recommended) route, read on...

instructions

  1. Check your python version. Open a terminal and type:

    $ python -V
    

    Python 2.4.4

  2. If you get exactly the output shown above, you're almost set. Skip to the last step in this section.
  3. If you get a message like "Python 2.5.X" or "SyntaxError: invalid syntax" or something other than "Python 2.4.4" check to see if you have python 2.4.

    ­$ python2.4
          ­Python 2.4.4 (#2, Oct  4 2007, 23:56:01)
          [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
          Type "help", "copyright", "credits" or "license" for more information.
          >>> ­
  4. If you don't have python 2.4 (you'll get error messages instead of the output above), get it, using whatever installation mechanism you choose.

    In Ubuntu, Debian, and other systems that use apt-get:

    $ sudo apt-get install python2.4
    
    In Fedora, Yellow Dog, and other systems that use yum:

    $ sudo yum install python2.4
    In Gentoo, or if you're using emerge:

    $ sudo emerge python2.4

    For other operating systems and installation procedures, see http://python.org/download/releases/2.4.4 for downloads and installation notes.

    In the future, we'll use the term <installation-command> to refer to "apt-get install," "yum install," "emerge," and their equivalents in various distros and operating systems.

  5. Now change your /usr/bin/python symlink to point to python2.4.


    $ sudo rm /usr/bin/python­
    $ sudo ln -s /usr/bin/python2.4 /usr/bin/python
    $ python -V
    Python 2.4.4 
  6. Finally, make sure you change your default python version to 2.4 in debian_defaults (or the equivalent for your operating system).

    In Ubuntu, Debian, or other Debian-based distros: (I'm using gedit here for newbie-accessibility, but you could replace "gksudo" with just "sudo" in a terminal, and "gedit" with "emacs" or "vim" or whatever your favorite editor is.­


    $ gksudo gedit /usr/share/python/debian_defaults


    In other distros and operating systems (if you know the filepath in a different OS, please list it here!) the above will generally be this instead:

    $ sudo <text-editor> /usr/share/python/<default-config-filename>

    Whichever command you type to open the file, the first three lines will look something like this.

    [DEFAULT]
    # the default python version
    default-version = python2.5

    And you should edit the third line so it looks exactly like this instead:

    [DEFAULT]
    # the default python version
    default-version = python2.4
    

    Save and close the file, and you're done.

    At this point you may want to return to building openplans notes or wherever else you came from.