How to build Python, so that a shared library (libpythonX.Y.so) is produced.

For an optimal configuration of the Apache module mod_wsgi, Graham Dumpleton recommends:

“you are highly encouraged to ensure that your Python installation has been configured and compiled with the –-enable-shared option to enable the production and use of a shared library for Python.”

(http://code.google.com/p/modwsgi/wiki/InstallationIssues : “Lack Of Python Shared Library”)

This recipe might save you a few minutes’ research:

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz  
tar vxzf Python-2.7.3.tgz  
cd Python-2.7.3  
PREFIX=$HOME/local/python-2.7.3  
export LD_RUN_PATH=$PREFIX/lib  
./configure --prefix=$PREFIX --enable-shared
make  
make install