Python is a very popular and useful programming and scripting language. What makes Python so popular and useful is its rich modules, easy learning, and usage, and being cross-platform. In this tutorial, we will learn how to install Python2, Python3 interpreter, tools, and libraries.
Python2 vs Python3
Python3 is the latest version of the Python programming language. Python2 is the previous version which is used for a long time. Python3 provides more performance, features, and modernity according to the Python2. But some Python projects maybe depend on Python2.
Install Python 2
Python downloads for Windows are provided from the following link where both Python2 and Python3 can be found here. But we will download the Python2 from the following link.
https://www.python.org/downloads/windows/

When we click to the Latest Python2 Release
we will be redirected to the Python 2 download page which can be also accessed from the following link. We will select the architecture of the Windows operating system like 32 or 64-bit. In this case, we will download the 64-bit installation MSI file.
https://www.python.org/downloads/release/python-2716/

If we are using Windows 10 we will see the following SmartScreen
warning where we will click to the Run
like below.

With the following screen, the Python2 installation will start. In the following screen, we have two options in order to select for which users we want to install Python2.
Install for all users
will install Python2 for all users currently exist in the operating systemInstall just for me
will install Python2 for the current user and other operating system users can not use Python2.

In the following screen, we will specify the Python2 installation path. All files, libraries, interpreters, and tools will be stored in this path. By default C:\Python27
is used but we can change whatever we want.

In the following screen, we will customize the Python2 installation. We can select the features we want to install. By default, most of the features are selected for installation which is very beneficial. We will also select the Add python.exe to Path
options which is very important.

Register Extensions
will set this installation as default Python by changing and setting registry values.Tcl/Tk
will install features like Tkinter, IDLE, pydoc.Documentation
will install Python HTMLHelp File.Utility Scripts
will install some tools.pip
will install the package manager for Python named Pip.Test suite
will installLib/test
libraries and test suite.Add python.exe to Path
is important because it will add the python interpreter to the operating system environment variables automatically. This will enable us to runpython
command from the command line directly. By default these options is not selected we will select it manually.
As installing all of these things in Python2 we require Administrator rights which will be provided in the following screen by clicking Yes
.

Following screen is about the file copy, registry change phase.

If the Python2 is installed without a problem we will see the following screen which says installation is completed successfully.

Install Python 3
Python3 is the latest main version of the Python programming language. The minor version for Python3 is 7 which means the latest version for Python is Python3.7. We can download the Python3 installer for the Windows operating system from the following page. There are 32 and 64-bit installers for the Python3. Also web-based installer
can be used to download installation files from the internet but this will require internet access.
https://www.python.org/downloads/release/python-374/

We will start the installation process of the Python3 by clicking the downloaded installer and the first screen provides us some options.

Install Now
will install the Python3 directly without ant customization options.Customize installation
will provide some options for the Python3 installation.Add Python 3.7 to PATH
will add Python3 interpreter and command to the Windows PATH where the python command can be run directly.
We will select the Customize Installation where we want to see and set some options.

Documentation
will install Python documentation files which can be helpful in internet isolated situations.pip
will install Python package manager named Pip which can install, update, and remove 3rd party Python packages, modules, and libraries.tcl/tk and IDLE
will install Tkinter libraries with the IDLE development environment.Python test suite
will install a standard library test suite.
We will click to Next and will see the following Advanced Options
screen.

Install for all users
will install Python3 for all the users for the operating systemsAssociate files with Python
will set the IDLE default editor for the Python or *.py extension filesCreate shortcuts for installed applications
will create shortcuts for Python interactive shell, IDLE, etc.Add Python to environment variables
will add python interpreters and commands to the environment variables to execute them directly from the command line.Precompiled standard library
will also install the Python standard library as of Python source code, not DLL.Download debugging symbols
will download debug symbols for the libraries which can be useful for debuggingDownload debug binaries
Customize install location
will specify the installation path for the Python3 which is the current user home directory.
Then we will click to the Install
to start the installation process. During the installation, we will see a similar screen to the following where the bar will show the installation percentage.

After the installation is successful we will see the following Setup was successful
screen. We can click the Close
button but we can also click to Diable path length limit
which will bypass the MAX_PATH limitation.

Non-interactive Python Installation
In the previous part, we have installed Python2 and Python3 interactively by using a GUI and clicking the Next buttons. We have also provided some configuration via checkboxes by enabling and disabling them. The Non-interactive Python Installation
will install Python2 via MS-DOS command line with no user interaction. We will just provide some parameters to the non-interactive installation for install configuration. For normal installation, we will just use msiexe
command /i
option for installation and provide the Python MSI installation file path and name.
> msiexec /i python-2.5.msi
For more detailed configuration some options and values can be provided to change default options like installation path, user, GUI.
- /qn – No interface
- /qb – Basic interface – just a small progress dialog
- /qb! – Like /qb, but hide the Cancel button
- /qr – Reduced interface – display all dialogs that don’t require user interaction (skip all modal dialogs)
- /qn+ – Like /qn, but display “Completed” dialog at the end
- /qb+ – Like /qb, but display “Completed” dialog at the end
- TARGETDIR=D:\python2 for installation target directory
- ALLUSERS=1 will install for all users but this requires Administrator privileges for the current MS-DOS or command-line interface.
Web-Based/Online Python Installation
Normally Python installation executables contain all require data, executable, libraries and binary. There is no need to get extra data from remote. But Web-based Python Installation
only provides the installation executable and all other Python tools are downloaded from the internet or web. All other configurations are the same as the regular Python installation.
Install and Update Python2 or Python3 With Chocolatey Package Manager
Chocolatey
is a package manager for Windows operating systems similar to the apt and dnf for Linux distributions. Python can be installed via Chocolatey with a single command. Following command will install the latest Python3 release to the current Windows operating system.
> choco install python
Also already install Python can be updated/upgraded to the latest version with the following command.
> choco upgrade python
If we do not need the Python we can use the chocolatey package manager in order to remove/uninstall currently installed Python.
> choco uninstall python
Check and Verify Python Version
We can check the installed Python version in different ways. python
or Python
is the general name where it will redirect to the default Python version which can be Python2 or Python3.
> python --version
> python
> pip -V

We can check the Python2 or Python3 version in detail by just running their specific commands like below.
> python2 --version
OR
> python3 --version
Open Installed Python Shell and Run Python Script
Python provides the IDLE
for creating and running Python scripts. IDLE also works as a interactive shell or command line for Python language. We can open the IDLE from the Programs
of start menu under the Python
item like below. Alternatively we can type the Python IDLE
to the start menu where Python IDLE will be listed.

Python IDLE or Shell can run Python commands and script.
