Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My server runs Python 2.4 by default, and I've used make altinstall to get an alternate Python 2.6 installation, for my Django webapp.

However, mod_wsgi seems to be defaulting to using /usr/bin/python (2.4) rather than /usr/local/bin/python2.6.

Is there a simple way to force mod_wsgi to use Python 2.6?

share|improve this question
up vote 6 down vote accepted

Read the documentation for mod_wsgi and it tells you what to do. See:

Specifically, use the WSGIPythonHome directive to tell mod_wsgi that your Python is actually in a different location.

If this doesn't work, then make sure you are no longer loading mod_python into same Apache if you had been previously. Perform a complete stop and start of Apache, not just a reload, for good measure to ensure that mod_python no longer hanging around. The mod_python module cant be used at the same time because it will take precedence in initialising Python and will use what ever it is compiled against, which could well be different to mod_wsgi. Normally this mixing will cause a crash, but feasible it may carry along a little bit before deciding to croak it.

share|improve this answer
Sorry, I don't know how I missed that bit of documentation! The documentation on the -fPIC error proved helpful, too. Thank you so much! – BobMarley Nov 26 '09 at 8:26
So I really had to re-compile the module .. thanks for convincing me. – nisc Feb 24 '12 at 21:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.