I also met the case to use both python2 and python3 on my Windows machine. Here’s how i resolved it:
- download python2x and python3x, installed them.
- add
C:\Python35;C:\Python35\Scripts;C:\Python27;C:\Python27\Scripts
to environment variablePATH
. - Go to
C:\Python35
to renamepython.exe
topython3.exe
, also toC:\Python27
, renamepython.exe
topython2.exe
. - restart your command window.
- type
python2 scriptname.py
, orpython3 scriptname.py
in command line to switch the version you like.