Question

I have a server which is running CentOS with cpanel/whm. Otherwise, it is pretty much a standard set up.

My problem is that such server is running python 2.4 and I need python 2.6 or later. How do I upgrade without breaking anything?

By the way, I currently have a django application running on that server, which I would also like to move to python 2.6 without breaking it. Is there anything extra that I have to do to do that?

Was it helpful?

Solution

You have to do a parallel install of the new Python.

If you try and update the default Python it will break your system completely.

The simplest thing is to install a newer version using one of the many RPMs that people have built to solve just this problem.

Whatever you do, do not try and install it from source.

OTHER TIPS

I always deploy python applications with pythonbrew, which allows you to easily install and switch between several pythons without having to touch the system python.

Pythonbrew compiles from source, which does require you to have a compiler and the correct libraries & headers installed. You can look at which you need here: Step by step pythonbrew installation (for debian based systems)

You can install any version of python from source as long as you don't overwrite cPanel's python 2.4 installation at /usr/bin. To do this, use the -prefix= option when you configure the python 2.x or python 3.x source for build.

The simplest way to install an alternate version of Python is to download the source and compile it. When you've finished running ./configure and make, you'll want to install using make altinstall, with python 2.6 you'd end up with an interpreter named python26

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top