About a month ago I setup Pylons on my VPS in a virtual environment using the go-pylons.py script they provide. I've, since then, been working on my website and have it all up and running. It works great.
Recently though I discovered that I created my virtual python environment using Python2.5. I now want to change this to Python2.7
I've got Python2.7 running on my server and it all works great. I then created another virtual environment for Pylons and have that up and running. When I try to modify my website's mod_wsgi dispatch file to use the new environment, I get a DistributionNotFound exception. What could be causing this?
Here's my dispatch.wsgi file:
import site
import os
# New Python virtual environment
# site.addsitedir('/usr/local/pylonsenv/lib/python2.7/site-packages')
# Old Python virtual environment
site.addsitedir('/usr/local/pylons/lib/python2.5/site-packages')
os.environ['PYTHON_EGG_CACHE'] = '/home/samsu/python/egg-cache'
from paste.deploy import loadapp
application = loadapp('config:/home/samsu/python/mywebsite/production.ini')
When I change the addsitedir
paths around and restart Apache, viewing the website throws the exception. As soon as I change it back, problem goes away.
Why can't I change virtual environments?