Installing Python in Windows
This article deals with installing Python on Windows. Even though Python can be installed in Windows, it is recommended to use Linux, to use Python and develop applications. While I have used windows 10 for the demonstration of installation, this can also be referred for installing the same in Windows 7.I have installed both Python2 and Python3.
Let’s begin!
Download the Python Software
Download the required files from the Python’s website [Python2 | Python3].
Installing Python 2
I have used the following steps to install Python 2
Installing Python 3
After installing Python 2, we will install Python 3. Note that if you want to install only Python 2( which is not recommended), then you have to append the python.exe
in the PATH variable.
Running Python 2 and Python 3
You can start Python 2, using py -2
command in your command terminal. For Python 3 use, py -3
.
Caveat! Differences between Py2 and Py3
Note: This part is just for beginners who would be installing python for the very first time. Of course, there are many more differences between the two version.
- print : In python 2, the print was a statement, and hence one could print any item, and wrapping them in curly brackets , was optional. However, due the misuse of the above flexibility, the print statement was changed into a function, and thus restricting the misuse of the above said advantage.
- Integer division : The integer division in python2 takes two numbers, and returns the integer portion, as it discards the decimal part. This was certainly not obvious, as
3/2
should return1.5
and not1
. Python 3 ensured that the integer division returns values in float, rather than int. - Speed : Python 3.3 performs at approximately the same speed as Python 2.7, although some benchmarks measure the new language as being much faster.