Python update on linux

I have a Linux VPS that uses an older version of python (2.4.3). This version does not include the UUID module, but I need it for a project. My options are to go to python2.6 or find a way to make uuid work with an older version. I am a complete Linux newbie. I don't know how to safely update python or how I can get the UUIDs working with the version already installed. What is the best option and how will I go about it?

+2


source to share


3 answers


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 install this in your Python2.4 or install Python2.6. If your distribution doesn't have this, then Python is fairly easy to compile from source. Review the requirements to ensure that all the libraries you need are installed before compiling Python. What is it.

+2


source


The safest way to update Python is to install it somewhere else (away from the default system path).

To do this, download the python source and do

./configure --prefix = / opt



(Assuming you want to install it in / opt, where most are system independent)

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

Another reason is that when you are doing your own development, it is much better to control which version of libraries (or interpreters) you are using, rather than using an operating system patch that used to work. A guided update is better than a sudden interruption of the application.

+6


source


The best solution would be to install python2.6 in the directory of your choice - it will give you access to many great features and improved memory management (python = 2.4 memory leak weird problem).

I have several pythons installed on my two computers, I found that the best solution for them is two directories:

$ HOME / USR-32 $ HOME / USR-64

accordingly for operating system use (I split $ HOME between 32 and 64 bit Linux).

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

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

This leads to avoidance of conflicts between versions and gives a lot of portability (you can use usb pendrives, etc.).

In the previous example, Python 2.6.2 was installed with the option:

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


source







All Articles