Recently, I have been working on deploying a pyramid (former pylons) application on a Debian 5 (Lenny) server using mod_wsgi and Python 2.7. Since Lenny only comes with Python 2.5 and third-party Python packages are basically non-existent due to dependency problems, newer Python versions need to be compiled manually.
1 2 3
Note that Python is configured to build a shared library (
--enable-shared) which is required to avoid several problems detailed in the mod_wsgi manual
Next we can download the mod_wsgi sources, extract them and compile using the following commands:
1 2 3
Note that the newly compiled Python executable is explicitly passed via
From here you can follow the instructions in the excellent mod_wsgi documentation to deploy your application.
If Python is unable to find the runtime library you will receive the following error message when configuring mod_wsgi:
/usr/local/bin/python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
As pointed out in the DotMatrix Blog this problem can be solved by creating the following two symlinks:
If you are running a 64-bit operating system the former needs to be changed to
/usr/lib64/ instead of