2

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?

2
  • If you don't get the response here, you may want to try serverfault.com .
    – JeffO
    Dec 10, 2009 at 12:47
  • 3
    Are you using mod_wsgi or mod_python or some other linkage?
    – S.Lott
    Dec 10, 2009 at 14:58

3 Answers 3

2

If you're using mod_python or mod_wsgi, you should reinstall them as they've probably been built to the python version you had when they were first installed on the system (which in your case appears to be Python 2.3).

4
  • How do I tell if the server is using mod_python or mod_wsgi (or rather, which of them)?
    – Pranab
    Dec 10, 2009 at 16:47
  • 2
    From the command line, run httpd -M or apachectl -M. Either should list dynamically and statically-loaded modules on your Apache installation. Dec 10, 2009 at 17:27
  • 2
    @Pranab - you most likely have mod_python. RedHat hasn't yet had a release that includes mod_wsgi. You also will need to re-compile the module to use the correct embedded interpreter. Re-installation won't change that.
    – JimB
    Dec 10, 2009 at 18:38
  • I eventually sidestepped the problem by installing my required Python modules to the older Python as well, by manually using python2.3 setup.py install.
    – Pranab
    Dec 11, 2009 at 19:33
1

Apache isn't calling python directly, so the path is irrelevant. You will probably want to build yourself a new mod_wsgi to link against python 2.6.4.

0

On RH box Apache probably runs as root user. Login as root and see which version of python root sees.

HIH

..richie

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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