mod_python and python2.5

Friday, 20 April, 2007

UPDATE: Of course, the easier alternative, is just to upgrade to Kubuntu Feisty… ;-)

More for my own reference than anything else….

To get mod_python working with python2.5 on kubuntu:

1. Install apache2, if you haven’t already.

2. Install python2.5:


sudo apt-get install python2.5
sudo apt-get install python2.5-dev

Don’t get rid of python2.4, since it’s still used by a number of things.

3. Change the symlink for /usr/bin/python to point at the new version:


sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.5 /usr/bin/python

4. Install apache apxs2:


sudo apt-get install apache2-threaded-dev

5. Download and extract the latest dist of mod_python. cd to that directory, configure and build:


./configure
make

6. Possibly a controversial step: install modpython as normal (apt-get), then replace the shared-objects with the .so’s you’ve just created:


sudo apt-get install libapache2-mod-python

From the downloaded modpython directory (i.e. where you ran configure & make), copy the shared-object files:


sudo cp src/mod_python.so /usr/lib/apache2/modules/
sudo cp dist/build/lib.linux-x86_64-2.5/mod_python/_psp.so /usr/lib/python2.4/site-packages/mod_python/

Copy the mod-python directory from python2.4 site-packages to 2.5:


sudo cp -R /usr/lib/python2.4/site-packages/mod_python/ /usr/lib/python2.5/site-packages/

Restart apache and use modpython as normal…

Leave a Reply