How To Install Python (Python2 and Python3) On Windows?
Python is 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.
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 Windows operating system like 32 or 64-bit. In this case, we will download the 64-bit installation MSI file.
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 userswill install Python2 for all users currently exist in the operating system
Install just for mewill 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, interpreter 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 Extensionswill set this installation as default Python by changing and setting registry values.
Tcl/Tkwill install features like Tkinter, IDLE, pydoc
Documentationwill install Python HTMLHelp File
Utility Scriptswill install some tools
pipwill install the package manager for Python named Pip
Test suitewill install
Lib/testlibraries and test suite
Add python.exe to Pathis important because it will add the python interpreter to the operating system environment variables automatically. This will enable us to run
pythoncommand from the command line directly. By default this 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
Following screen is about the file copy, registry change phase.
If the Python2 is installed without problem we will see the following screen which says installation is completed successfully.
Install Python 3
Python3 is the latest main version for 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.
We will start the installation process of the Python3 by clicking the downloaded installer and the first screen provides us some options.
Install Nowwill install the Python3 directly without ant customization options.
Customize installationwill provide some options for PYthon3 installation.
Add Python 3.7 to PATHwill 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.
Documentationwill install Python documentation files which can be helpful in internet isolated situations.
pipwill install Python package manager named Pip which can install, update and remove 3rd party Python packages, modules, and libraries.
tcl/tk and IDLEwill install tkinter libraries with the IDLE development environment.
Python test suitewill install standard library test suite.
We will click to Next and will see the following
Advanced Options screen.
Install for all userswill install Python3 for all the users for the operating systems
Associate files with Pythonwill set the IDLE default editor for the Python or *.py extension files
Create shortcuts for installed applicationswill create shortcuts for Python interactive shell, IDLE etc.
Add Python to environment variableswill add python interpreter and commands to the environment variables to execute them directly from command line.
Precompiled standard librarywill also install the Python standard library as of Python source code, not DLL.
Download debudding symbolswill download debug symbols for the libraries which can be useful for debugging
Download debug binaries
Customize install locationwill 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.
At the we if 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.
Check and Verify Python Version
We can check the installed Python version in different ways.
Python is the general name where it will redirect to the default Python version which can be Python2 or Python3.
> python --version
> pip -V
We can alsı
We can check the Python2 or Python3 version in details by just running their specific commands like below.
> python2 --version
> python3 --version