Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 6 down vote accepted

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

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

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

 
discard

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.