tags:

views:

631

answers:

3

I have a linux VPS that uses an older version of python (2.4.3). This version doesn't include the UUID module, but I need it for a project. My options are to upgrade to python2.6 or find a way to make uuid work with the older version. I am a complete linux newbie. I don't know how to upgrade python safely or how I could get the UUID modules working with the already installed version. What is a better option and how would I go about doing it?

+2  A: 

The UUID module exists as a separate package for Python 2.3 and up:

http://pypi.python.org/pypi/uuid/1.30

So you can either install that in your Python2.4, or install Python2.6. If your distro doesn't have it, then Python is quite simple to compile from source. Look through the requirements to make sure all the libraries you need/want are installed before compiling Python. That's it.

Lennart Regebro
how would i go about installing this module? where would i put it.
tehryan
You install it as most python modules, with "python setup.py install".
Lennart Regebro
+2  A: 

The safest way to upgrading Python is to install it to a different location (away from the default system path).

To do this, download the source of python and do a

./configure --prefix=/opt

(Assuming you want to install it to /opt which is where most install non system dependant stuff to)

The reason why I say this is because some other system libraries may depend on the current version of python.

Another reason is that as you are doing your own custom development, it is much better to have control over what version of the libraries (or interpreters) you are using rather than have a operating system patch break something that was working before. A controlled upgrade is better than having the application break on you all of a sudden.

nolim1t
A: 

The best solution will be installing python2.6 in the choosen directory - It will you give you access to many great features and better memory handling (infamous python=2.4 memory leak problem).

I have got several pythons installed onto my two computers, I found that the best solution for are two directories:

$HOME/usr-32 $HOME/usr-64

respectively to using operating system (I share $HOME between 32 and 64 bit versions of Linux).

In each I have one directory for every application/program, for example:

ls ~/usr-64/python-2.6.2/
bin  include  lib  share

It leads completetely to avoiding conflicts between version and gives great portability (you can use usb pendrives etc).

Python 2.6.2 in previously example has been installed with option:

./configure --prefix=$HOME/usr-64/python-2.6.2
bluszcz