views:

242

answers:

4

As you can see by reading my other thread today here, I'm having some troubles upgrading Python.

At the moment I have Python 2.4 with Django installed on a CentOS machine. However I've recently deployed an application that requires 2.5 which has resulted in me installing that and getting into a whole load of mess. My original assumption was that I could direct Django to a different Python version, however as S.Lott informed me, I had it backwards... you attach Django to Python, not the other way round. Which means I currently have: Python 2.4 with Django and Python 2.5.

I've tried a few things so far to no avail. The first idea being an easy_install which would put Django onto the Python 2.5 (So I'd have 2 versions of python with seperate Djangos). Therefore I went into 2.5's directory and did that, which then allowed me to find out that it had just reinstalls it on 2.4, not 2.5. Therefore first question is How do I direct easy_install to Python 2.5, not 2.4?

Is there no way to just hit 'upgrade' and for a full update to occur? I know this may be asking for much, however it just seems like so much hassle and I'm surprised I can't find anyone else complaining. Any help would be greatly appreciated.

+2  A: 

I don't know anything about CentOS, but if you have multiple Python version installed and you wan't to install packages using easy_install, you just need to call it with the corresponding Python interpreter. This should install the packing into the site-package directory of Python 2.5:

# /path/to/python-2.5 easy_install Django
Haes
A: 

easy_install is a shell script the first line of which tells it where python is installed (I am on OSX so can't say exactly what your directories will be )

So you could copy easy_install and change the first line to point to 2.5. (or do as Heas suggests)

Althernatively when you installed python 2.5 there might be a file easy_install-2.5 with the correct python (again these were installed for me under OSX so might be a special version)

Mark
A: 

You don't need to 'install' Django at all, it just needs to live on the Pythonpath somewhere. Assuming it's currently in the Python2.4 site-packages directory, you can just move it to the 2.5 one:

sudo mv /usr/lib/python2.4/site-packages/django /usr/lib/python2.5/site-packages/django

or whatever the correct path is for CentOS.

However, as I noted on your other question, this won't necessarily help - S.Lott was unfortunately misleading in his answer. To serve Django via modpython or modwsgi with a new Python version, you'll need to recompile those extensions or download packages versions precompiled with Python 2.5.

Daniel Roseman
A: 

assuming your python2.5 interpreter lives in /usr/bin/python2.5, you can install setuptools for python2.5 as such:

curl -O http://peak.telecommunity.com/dist/ez_setup.py
sudo /usr/bin/python2.5 ez_setup.py

Among other things, this installs an "easy_install-2.5" script in your $PATH (check the output of the above command).

Now you have two easy_install scripts: one for python 2.4 ("easy_install") and one for python 2.5 ("easy_install-2.5").

To install Django for your python2.5, use

sudo easy_install-2.5 django

That's it!

captnswing