Reputation: 2485
The setup: Win7 environment with Python 2.7.5 and Python 3.3.2 installed and added to the system path.
C:\\py -2
will launch Python 2.7.5,
C:\\py -3
will launch Python 3.3.2,
C:\\python
will launch Python 3.3.2.
Is it possible to toggle which Python version "python" maps to, and if so, how?
Upvotes: 0
Views: 359
Reputation: 70602
In your last line, Windows picks the first directory on your %PATH%
containing a python
executable. You cannot change that, short of reordering your path.
I use this little py.bat
file in a directory early in my path:
\python27\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
So I just type py
. I have a similar py3.bat
to start Python 3 instead. Inside other .bat
files I call py.bat
or py3.bat
, so they all pick up the version of Python I want when I change py.bat
and/or py3.bat
.
Edit: by the way, I realize my py.bat
's name conflicts with the Python launcher named py
. I don't care :-)
Upvotes: 2