This post will introduce how to install Python 2 and Python 3 together in Windows 7 on the same PC.
Nevigate to Python official website and download latest Python2 installer and Python3 installer. Please choose the correct version for your Windows 7 system. For example, my Windows 7 is 64 bit, so I would choose Windows x86-64 MSI installer version for Python2 and Windows x86-64 executable installer for Python3.
Run the two installers which you just downloaded. When you install Python3, there is an option you could choose to add Python3 to environment variables PATH, or please go to next step to add Python2 & 3 to environment variables.
Right Click on My Computer and go to Properties. Go to Advanced System Settings. Click on Environment Variables and edit PATH and add the path to your Python 3 and Python 2 installation directories.
Please see below PATH variable on my computer.
Now if you go to Windows command line and type below command
the output should be like this
There is only one Pyhton version shown up. If the Python version is shown as 2.7.13, go to Python 3 installation directory (mine is C:\python3). And copy python.exe to the same directory. Rename the copied exe file as python3.exe. Do the similar for Python2, but rename the copied exe file as python2.exe in Python 2 installation directory.
Then go to Windows command line again, try to type below two commands and check their outputs.
Hopefully you could get the same results as below
As you can see Python 2 and 3 are both available now on the same computer. To use them, run python2 to call Python 2 or python3 to call Python 3.