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
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
Python installer does no change to PATH environment variable under windows. When typing something like
python setup.py
windows first looks for python in PATH, then in current user registry hiveand then in local machine registry hive
Make two simple .cmd files:
python25.cmd:
python27.cmd:
Now you can switch between Python 2.5 and 2.7. :)
Change the registry key at
Now that Python 3.3 is released it is easiest to use the py.exe utility described here: http://www.python.org/dev/peps/pep-0397/
It allows you to specify a Python version in your script file using a UNIX style directive. There are also command line and environment variable options for controlling which version of Python is run.
The easiest way to get this utility is to install Python 3.3 or later.
If you want to switch between Python 2.x and Python 3.x then easiest way is to use Python Launcher which is included since 3.3 version. This is basically py.exe in Windows folder. To start Python 3.x command prompt, just type
To execute script with Python 3.x, use
If you don't specify -3 then 2.x version is used by default. You can also make this explicit by using -2.7 switch.
Finally, you can now embed the version number to use in .script file itself. This works because after Python 3.3+ is installed, it associated py.exe with .py files.
Change your PATH system environment variable to point to the version of Python you want to use.