Skip to content Skip to sidebar Skip to footer

Why Can't I Install Python 2.7 Under Centos 5.5?

Centos 5.5 comes with python 2.4 installed, and I needed python 2.7 for a project. I downloaded the source, ran, removed, and tried again with a couple alternative builds: ./conf

Solution 1:

First off you don't indicate that you have compiled Python with --enable-shared. If that isn't a default for that Python version, that is not desirable. As per:

http://code.google.com/p/modwsgi/wiki/InstallationIssues#Lack_Of_Python_Shared_Library

you can check whether Python was installed with a shared library or not.

After compiling mod_wsgi, see where the mod_wsgi.so is picking up the libpython2.7.so from.

Next, make sure you don't have multiple different libpython2.7.so in your system due to your multiple installation attempts of Python. You should really only have one.

If the libpython2.7.so is not in standard library search path, then the location of that directory should be embedded into mod_wsgi when compiled. If installed under /opt/python2.7, you would do:

./configure --with-python=/opt/python2.7/bin/python --with-apxs=/path/to/apxs
LD_RUN_PATH=/opt/python2.7/lib make
make install

You should then work out what sys.prefix is for that Python installation by running in command line Python invocation.

import sys
print sys.prefix

What value it says should then be set with WSGIPythonHome. It should be /opt/python2.7 fo that location. WSGIPythonHome is only required because you have installed to an alternate prefix to the system wide Python.

You should not be adding Python install directory locations to either sys.path or WSGIPythonPath directly.

Get that much working with a hello world WSGI program. No virtual environments, no Django or higher level frameworks.

Note that the Python installation must be readable to user that Apache runs as.


Post a Comment for "Why Can't I Install Python 2.7 Under Centos 5.5?"