How to install both Python 2.x and Python 3.x on same computer

Many people try to go to Python 3 but they got to keep up with Python 2 because of lack of support and not all plugins and mods are yet updated to Python 3. So if you want to install both version and execute both version scripts correctly, here is the trick.

First download both Python 2.x and Python 3.x and install them as usual, there won’t be any problem with it. During the installation choose different folders as installation directory for both. I have installed them in same drive and it looks like this.

Installing python 2 and python 3In folder Python27 is Python 2.7.1 and in folder Python33 is Python 3.3

You can execute python script with python 3 by entering ” C:\python33\python.exe ” in command prompt window and you can execute python script with python 2 by entering ” C:\python27\python.exe

Or if you want to execute them in command prompt window without much path typing job then follow the steps below.

OKAY, Now what we gonna do is add variable paths to the windows, I have already posted a tutorial about how to add system variable path to windows before.

Open System information window by clicking “System” icon in control panel or Just right click on “Computer” in start menu and select Properties.

System in control panel3Now system Information window opens and you select advanced system settings from left side of the window.Advanced system setting in system info windowA new window appears, now click on the Environment variable button.

Environment variableNow Environment variable window appears, find path variables in system variables, select it and click on edit.System variable pathNow a window appears asking you to enter paths.pathsMove to the end of line and type this ” ;C:\python33;C:\python27 “. Because, they are my installation directory for python versions. You should enter the right directory you installed python in. And click OK, close all other windows.

added variablesNow we have added the Python paths to the system, so it is easily accessible from command prompt window. Now, Open the directory containing Python 3 and rename python.exe to python3.exe
python 3 renamedNow in Python 2 Directory rename Python.exe to python2.exe

python 2 renamedThat’s all, now you can access python 2 and python 3 in command prompt just by typing python3 or python2.

python cmd window