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

On a Red Hat box, I upgraded Python from 2.3 to 2.6.4 and changed the symlink to python so when I type in python the 2.6.4 interpreter comes up.

However my .py file works from the command-line, but not in the browser. It seemed like a sys.path issue so I opened the file in a browser and printed out sys.path.

Surprisingly, my sys.path is different when called from a browser than when called from a command-line. Because the paths are all referring to 2.3, I believe Apache is picking up Python 2.3 rather than the new 2.6.4 version I installed.

How do I make Apache use Python 2.6.4 rather than 2.3? Both are installed.

share|improve this question

2 Answers 2

You're probably going to need to recompile mod_python. The better solution is to not use mod_python at all. Instead, run your Python applications as FastCGI which will provide you with a much more flexible platform in the long term.

share|improve this answer
    
Wow. This is not my server. Any way to do this without rebuilding Apache? –  Pranab Dec 10 '09 at 13:09
    
Use some other method of serving your Python code (i.e. FastCGI) –  rodjek Dec 10 '09 at 13:17
    
I haven't installed FastCGI before - but fastcgi.com/drupal/?q=node/9 (apparently the official docs?) say I need to install mod_fastcgi? How do I find if it is installed? –  Pranab Dec 10 '09 at 13:26

I'd recommend to install the python2.6 and mod_python 2.6 packages from iuscommunity repository . They are very stable and reliable.

share|improve this answer
    
You're assuming that he's using a RedHat based distribution –  rodjek Dec 10 '09 at 13:49
    
I am using RedHat, I did mention in the question. Thank you all, I will go and Google both mod_python and mod_fastcgi later. Right now I solved my original issue by re-installing modules I needed, on Python 2.3. –  Pranab Dec 10 '09 at 13:55
    
Didn't know about IUS, thanks :) –  Joril Dec 10 '09 at 15:22

Your Answer

 
discard

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