Python is a widely used high-level programming language for general-purpose programming, created by Guido Van Rossum and first released in 1991.
Python features a dynamic type system and automatic memory management and supports multiple programming paradigms, including object-oriented, imperative, functional programming, and procedural styles.
It has a large and comprehensive standard library and a great community of developers backing it.
Python is addressed as the programming language of the century it is used widely in almost every field from web development to Data science.
Have you always wanted to learn how to program in Python?
If the answer to that question is yes, you have begun one of the greatest adventures of this century.
Python is a software that can be installed and run on multiple operating systems including Mac OS X, or OS/2, Linux, Unix, and Windows. Many Linux distro already has it pre-installed.
If you have a Windows machine first then you need to install Python because Python doesn't come bundled with Windows.
In this article, we will show you how to install Python on a Windows computer.
So, There are two major versions of Python which are currently in active use:
- Python 3.x is the latest version and is under active development.
- Python 2.x is the legacy version and will receive security updates until 2020. No new features will be
implemented. Note that many projects still use Python 2, although migrating to Python 3 is getting easier.
Python 3 is regarded as the future of Python and is the version of the language that is currently in development. A major overhaul, Python 3 was released in late 2008 to address and amend intrinsic design flaws of previous versions of the language.
To know more about the difference between Python 3 and Python 2 read this - Python 2 VS Python 3
If you are starting off your programming journey in python then it is advisable to go for Python 3.x, Although in this article, we will go through the installation of both versions.
Installing Python 2.x on Windows
Note - Don't follow this steps if you want to Install Python 3.x, Skip this part and scroll straight to the Python 3.x installtion
Let's Start with Python 2.x installation.
First, we need to install the official installers which is available at Python 2.x Installer
Go to the site and chose the latest Python 2 release as shown below
This installer will install the appropriate 32-bit or 64-bit version on your computer automatically.
But if it doesn't you can always do it manually, click on the Link and scroll down to the bottom and select either Windows x86-64 executable installer for 64-bit or Windows x86 executable installer for 32-bit.
If you are on a 32-bit processor then you should always stick to the 32-bit installer for 64-bit machines either one will work but the 64-bit installer is advisable.
Once the download is complete simply double-click on it to invoke the installer dialog and The following box will show up.
Select “Install for all users” and then click “Next.”
The next dialog will ask you about the path where you want python to be installed, leave it as default and click on Next.
c:\Python27\ is the path where our python installation is going to be placed.
In the "Customize Python 2.7.15" window, scroll to the bottom of the list, click the arrow next to "Add python.exe to Path", and click on "Entire feature will be installed on local hard drive", as shown below then Click Next".
Next, you will see the last dialog click on Finish and you are done with the installation of Python 2.x of your windows machine.
How to verify the Installation?
Run command prompt and type python
then enter, you should see similar output your version of python may vary but if you see python 2.x there, then your installation was successful.
You can also run python --version
to check the python version.
Now let's move on to Python 3 installation.
How to install Python 3 on Windows?
If you are new to Python programming we strongly recommend you go for Python 3.x because this version is currently under development.
Python 3 had some major modification to improve intrinsic design flaws of previous versions of the language.
That being said, let's get started with the installation of Python 3 on your windows machine.
First, we need to install the official installer which is available at Python 3.x Installer
Go to the site and click on the latest Python 3 release as shown below,
Then in the next page scroll down to the bottom and select either Windows x86-64 executable installer for 64-bit or Windows x86 executable installer for 32-bit.
If you are on a 32-bit processor then you should always stick to the 32-bit installer for 64-bit machines either one will work but the 64-bit installer is advisable.
This will download the installer for you, once the download is complete double click on it to invoke the GUI installer dialog.
If you did everything right, then you will see this dialog on your screen.
By default, Python will install for all users leave it as it is and make sure to click the checkbox below "Add Python 3.7 to PATH", enabling it will let you run python commands from the terminal.
Then click on Install Now this will install Python 3 on your windows machine
.
After the installation is complete you can verify the installation from command prompt itself.
Run command prompt and execute this command as shown below - python --version
C:\Users\USER>python --versionPython 3.7.2
Yay! we have successfully installed python 3 in our windows machine, now let's run a simple hello world program to check if everything is working as expected or not.
Read this to learn how to run hello world program in Python 3.
Have questions? Feel free to drop a comment below.