Install Python and start using it in windows or linux

Posted on Dec. 13, 2018

Install python and start using it

In this series I am going to use python 2.7 version, since most of the systems are still using Python2. Stable Python 3 is released and if you want to start with that also there is no problem. Most of the programs are compatible to Python3 except some syntaxes.


If you are using Ubuntu, Redhat or any other Linux systems python is already installed by default. Otherwise just install using apt-get install python2, python-pip for Ubuntu and yum install python2, python-pip for centos based.


In windows you need to download installer msi file and then you can install python. If you install python in windows using installer you will get an interactive IDLE also which will be very helpful while you learning python. Below is the screen of IDLE in windows.


You can execute python syntax/lines in this IDLE.

Now open your cmd or terminal and type python , then you will get into python shell which is same as shown above, but only difference is IDLE gives more functionalities while we learn python we can use those. But no problem if you are running python in UNIX systems , at the end we are all going to write python code.

Python shell shown below.



If you observe above images I am using this print ‘kishore’, yeah that is print statement in python syntax, If you are able to print something like above congrats python is installed correctly.

We are moving to next things i.e writing python code , so open your favourite editor and start a new file and copy the below code.

print 123
print "this is line1"
print "line2", 123

If you are using python 3 version then statements would be print(123), print("this is line1")

save the above code in a new file called Wait what .py extension for a file, If we save our file with .py extension only code can be recognized as python code and will be executed. Of course we have lot of ways to run python code files without .py extensions also, but having .py extension is recommended so that no confusion for others also.

Now if we want to execute that python file we need to change to the directory where file is located and execute the below command


Then we will get the output of above 3 statements.


Now we are good to go to write python code and execute. So let’s continue to next posts that is Data Types in Python.


Please log in to leave a comment.