I have created a virtualenv for developing in Django but Django is not using the correct instance of Python. Here’s what I’ve found out:
-
C:\Python27is not in my path. If I runpythonfrom a command prompt it says it’s not recognized -
When I start up the virtualenv, run python and check
sys.executableit does point to the virtualenv’s instance of python andsys.pathis also pointing to the correct place -
When I run
manage.py shellfrom within the virtualenv and check thesys.executableandsys.paththey are both pointing to theC:\python27installation
Any ideas as to what’s going on?
Are you running
./manage.py shellorpython manage.py shell? It can make a difference.Using the
./version uses the shebang line for the interpreter and normally results in using the system-level interpreter. As you’ve seen yourself, runningpythonuses the virtualenv’s version, sopython manage.py shellshould as well.