Note: Following instructions are written for Python 2.7 (unless specified): instructions for Python 3.x are similar.
WINDOWS
First, download the latest version of Python 2.7 from the official Website (https://www.python.org/downloads/). Version is provided as an MSI package. To install it manually, just double-click the file.
By default, Python installs to a directory:
C:\\Python27\\
Warning: installation does not automatically modify the PATH environment variable.
Assuming that your Python installation is in C:\Python27, add this to your PATH:
C:\\Python27\\;C:\\Python27\\Scripts\\
Now to check if Python installation is valid write in cmd:
python --version
Python 2.x and 3.x Side-By-Side
To install and use both Python 2.x and 3.x side-by-side on a Windows machine:
* Ensure Python is installed for all users.
* Optional: add Python to `PATH` to make Python 2.x callable from the command-line using `python`.
* Again, ensure Python is installed for all users.
* Optional: add Python to `PATH` to make Python 3.x callable from the command-line using `python`. This may override Python 2.x `PATH` settings, so double-check your `PATH` and ensure it's configured to your preferences.
* Make sure to install the `py launcher` for all users.
Python 3 will install the Python launcher which can be used to launch Python 2.x and Python 3.x interchangeably from the command-line:
P:\\>py -3
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
C:\\>py -2
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
To use the corresponding version of pip
for a specific Python version, use:
C:\\>py -3 -m pip -V
pip 9.0.1 from C:\\Python36\\lib\\site-packages (python 3.6)
C:\\>py -2 -m pip -V
pip 9.0.1 from C:\\Python27\\lib\\site-packages (python 2.7)