wsgi application is using an older python version
Question: I have deployed a Pyramid app using mod_wsgi.

I have setup the python path in the virtualhost:

    
    
    WSGIDaemonProcess MyApp user=myUser group=staff threads=4 python-path=/home/myapp/env/lib/python2.7/site-packages
    WSGIScriptAlias / /home/myapp/env/pyramid.wsgi
    

for debugging purposes, in pyramid.wsgi, I have also put:

    
    
    import sys
    
    print(sys.path)
    print(sys.version)
    

When I visit the app I can see the app is using python 2.6 instead of 2.7!

The sys.path outputs this:

    
    
     ['/home/myapp/env/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', 
    '/home/myapp/env/lib/python2.7/site-packages/pip-1.0.1-py2.7.egg', 
    '/home/myapp/env/lib/python2.7/site-packages', 
    '/home/myapp/env/lib/python2.7/site-packages/PIL', 
    '/opt/local/lib/python2.6/site-packages/setuptools-0.6c12dev_r88846-py2.6.egg', 
    '/opt/local/lib/python2.6/site-packages/virtualenv-1.6.1-py2.6.egg', 
    '/opt/local/lib/python26.zip', 
    '/opt/local/lib/python2.6', 
    '/opt/local/lib/python2.6/plat-sunos5', 
    '/opt/local/lib/python2.6/lib-tk', 
    '/opt/local/lib/python2.6/lib-old', 
    '/opt/local/lib/python2.6/lib-dynload', 
    '/opt/local/lib/python2.6/site-packages']
    

You can see the python 2.6 paths are there, but if I ssh to the server and
execute python it launches python2.7.

where does 2.6 come from? which user(apache?) is calling this wsgi app so I
can change its python environment?

pls help!


Answer: mod_wsgi doesn't care what version `python` is. It's built against the Python
library itself, so if you want it to use a different version then you need to
rebuild it.

