I would like to upgrade python for django. Currently I have python 2.4.3 on my Red Hat server. I have installed python 2.7.1, but the default python is still 2.4.3 (It didn't upgrade python, but installed python 2.7 separately). Django python version is also still 2.4.3 as well. I want to make a change so Django runs with 2.7. How do I overcome this problem?
RedHat has many tools that depend on Python 2.4 (
yum is an example of this) so make sure you don't overwrite the standard Python binary.
Depending on how you installed it, you may be able to get to it with the command
python2.7. So instead of running
If that doesn't work, you might need to reference the Python binary directly as it might not be in the system path. From memory, it should be something like
/installpath/bin/python. You might want to symlink that into /usr/bin or something so it's available in your system path, just make sure to name it python2.7 or python27 not just Python.
You should really consider running virtualenv, located on PyPi. It sets up a virtual environment for running different versions of Python, which allows you to avoid interfering with the system's Python 2.4.
I have the same problem on my CentOS VPS, and found
virtualenv as the solution. It's not quite as simple as everyone says (when you build third-party packages that aren't Python-based, say that compile in C, you have to make sure they point to the right Python libraries for compilation). But it generally works nicely.