# Windows – Python in command line runs the wrong version

command linepathpythonwindows

I have several versions of Python installed on a Windows 7 computer.

I want to run Python 2.7 by default, but for whatever reason, typing python in the command line runs Python version 2.4.5. I've tried adding C:\Python27 to my system path variable as per this question, and manually combed my path variable it to make sure Python 2.4.5 wasn't tossed in there by mistake, but that didn't fix the issue. I have to type in C:\Python27\python.exe every time I want to access the correct version of python I want.

What other places can I check? How can I make the command line use the correct version of python?

I also found this but it's not for windows.

[EDIT]
My path (separated by semicolons):

C:\Program Files\Common Files\Microsoft Shared\Windows Live;
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Dell\DW WLAN Card\Driver;
C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;
C:\Program Files (x86)\Windows Live\Shared;
c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;
c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;
c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;
C:\Program Files\TortoiseGit\bin;
C:\Program Files\Java\jdk1.6.0_26\bin;
C:\Program Files\Java\jdk1.6.0_21 ;
C:\Program Files\IVI Foundation\VISA\Win64\Bin\;
C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;
C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;
C:\Program Files\WPIJavaCV\OpenCV_2.2.0\bin;
C:\Program Files (x86)\LilyPond\usr\bin;
C:\Program Files\TortoiseSVN\bin;
C:\Program Files (x86)\doxygen\bin;
C:\Program Files (x86)\Graphviz 2.28\bin;
C:\Users\Michael\bin\Misc\cppcheck\;
C:\Program Files (x86)\Git\cmd;
C:\Python27\python.exe;
C:\Ruby192\bin;
C:\Users\Michael\AppData\Roaming\cabal\bin;
C:\Python27\;


[EDIT 2]
Running python spews this out:

'import site' failed; used -v for traceback
Python 2.4.5 (#1, Jul 22 2011, 02:01:04)
[GCC 4.1.1] on mingw32
>>>


…and running python --version (as suggested below) seems to be an unrecognized option.

(I also tried running python -v, and it appears that Python 2.4 is trying to import libraries from C:\Python27\Lib, and failed due to a syntax error when it encountered a with statement, which was added in later version, I think)

Also, I'm not sure if it's significant or not, but the above python version says something about GCC and mingw32, while running C:\python27\python.exe shows this:

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
>>>>


import sys

@C:\Python27\Python.exe \$*