Here we will see how to install Python(or IDLE the Python coding software).To check if Python is installed in Windows go to search and find command prompt and then type the command.
C:\Users\Your Name>python –version
If you get any mesage other than the Python version then Python is not yet installed in your system.To install Python go to https://www.python.org/downloads/windows/ and download the Windows x86 web-based installer or Windows x86 executable installer and install it.
After the installation open the CMD using the “Run as administrator” and type ‘python’. If you see any message like ‘‘python’ is not recognized as an internal or external command‘, then go to “This PC” , right click and click on ‘Properties‘ and in the left column clik on ‘Advanced system settings‘ and at the botom click on ‘Environment variables..‘ and under ‘System variables‘ click on ‘Path‘ and click on ‘Edit…‘ and clcik on ‘New‘ and add the path of the Python installation directory, in my case it is ‘C:\python’. After this restart your computer.
In Linux system or Mac to check if Python is installed open the terminal and type the command,
If python is not found you can install it by typing.
*On Debian derivatives such as Ubuntu, use APT:
$ sudo apt-get install python3
*On Red Hat and derivatives, use yum:
$ sudo yum install python
*On SUSE and derivatives, use zypper:
$ sudo zypper install python3
After the installation check the version.
A quick note for Windows users
After you have installed Python in Windows you can execute Python program in two ways:
i)Using the IDEL for Python.You can find this in the Python installation directory or simply search for ‘IDLE’.
ii)By using the windows cmd prompt.
Using Python IDLE
Open up your IDLE,the IDLE will look like this:
Now type the command given below:
And press ‘Enter’ if you get the result as shown below then your python is working.
Using Cmd prompt
Click on search and type ‘cmd’,if you find it ‘Right click’ and click on “Run as administrator”.After that enter ‘python’,now your command prompt should look like this.
After this enter enter the command:
And press enter you should get the text “Hello world”.
After this type “exit()“.Now I will show you how to execute a python program using the python file.Go to your “C” local disk directory and make a folder name ‘Python’.After that copy the directory of the Python folder which is “C:\Python”.Now go to your cmd and type:
Now the directory in you cmd will change to “cd C:\Python”.Inside the folder ‘Python’ create a file and inside the file write the code:
Now save the file as ‘basic.py’,the .py extension is use for python file.Now go to your cmd prompt and type :
You will get the text “Hello world!” ,the screen look like this.
In this second method we are using a python file to execute the program without directly writing the code in the cmd prompt.
Python installation is now done,we can start learning some basics and try to write some meaningful codes and later own build our own project.