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?


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.

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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