I have two python versions: Python 2.5 and Python 2.7. When I'm setting up django, I want to use Python 2.7, but django is using Python 2.5 somehow.
How can I make sure that django use Python 2.7? I'm using Windows XP
Changing your PATH will help, if you always call python directly, rather than relying on file association.
For example: "python foo.py"
will run the 'foo' script with whichever python is first on your PATH.
However, if you just run "foo.py"
, the handler associated in the registry, for this file extension, will be the first one called.
In your case, it sounds like that would be python 2.5. Have a look by opening regedit, and checking the values of:
HKEY_CLASSES_ROOT\Python.File\shell\open\command
The (default) value listed will probably be something like "C:\Python25\python.exe" "%1" %*
A quick (and dirty?) fix for you would be to change these values to the python version you actually want.
A better fix would be to do something like what's outlined in this feature request:
http://bugs.python.org/issue4485
Since then, as long as you had admin rights, you could switch as you needed by pointing assoc at the version you want quickly.
Make two simple .cmd files:
python25.cmd:
@echo off
set PYTHONHOME=c:\python25
set PATH=%PATH%;c:\python25
python27.cmd:
@echo off
set PYTHONHOME=c:\python27
set PATH=%PATH%;c:\python27
Now you can switch between Python 2.5 and 2.7. :)
Change your PATH system environment variable to point to the version of Python you want to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With