PYTHON - INSTALLATION
To run Python Programms in you PC, you need to install Python first.
Installation of Python for Windows OS
Below are the steps to install Python on Windows OS :
×
-
Goto the below link and download the latest version of Python.
https://www.python.org/downloads/
-
Then double click on the exe file and install Python in your PC.
-
Once Python is Installed, you can open the Command Prompt and Type 'python --version'.
If the version is shown then Python is successfully installed in your system.
Installation of Python for MAC OS
Below are the steps to install Python on MAC OS :
-
Goto the below link and download the latest version of Python.
https://www.python.org/downloads/macos/
-
Then click on the 'pkg' file to install Python.
-
Once Python is Installed, you can open the Command Prompt and Type 'python --version' or 'py --version'.
If the version is shown then Python is successfully installed in your system.
Now, that we have Installed Python. Let us see how we can run a Python Program.
Running a Python Program in Windows OS
Let us write a Program that will print 'Hello World'.
-
The first thing we will do is open 'Notepad' in Windows OS.
-
Once 'Notepad' is opened. You can type the lines of code there.
And now, since we are trying to print 'Hello World'. One line of code is enough in Python.
print("Hello World")
-
Then save with '.py' extension. Say 'FirstProgram.py'.
-
Then run using the command 'python FirstProgram.py' or 'py FirstProgram.py'.
Running a Python Program in MAC OS
Let us write a Program that will print 'Hello World'.
-
The first thing we will do is open 'TextEdit' in MAC.
-
Once 'Notepad' is opened. You can type the lines of code there.
And now, since we are trying to print 'Hello World'. One line of code is enough in Python.
print("Hello World")
-
Then save with '.py' extension. Say 'FirstProgram.py'.
-
Then run using the command 'python FirstProgram.py'.