In previous video we have seen how to install python in the System.
We have also seen how to write Hello World program using IDLE.
IDLE - Integrated DeveLopment Environment.
In this video we will see "How to run Python script from command prompt".
1. Install Python. [Visit my previous tutorial]
2. Environment Setup.
Why we need to set Environment ?
-------------------------------
"python" is the name of interpreter for Python programming language.
python.exe interpreter is present inside Python installation directory usually in Program Files.
Hence we need to tell OS about python interpreter.
Set Python installation directory to the PATH variable.
SET UP PATH
-----------
Go to the directory where python.exe file is present.
Usually inside "C:\Program Files\Python 3.5"
Copy this location from address bar.
Now go to the System properties. [Shortcut for windows 8 : Alt + C + S ]
Click on Advanced System Settings.
Click on Environment Variables.
Under user variable click on New...
Give variable name as PATH (or path)
[
If you have previously created PATH variable then click on Edit
Add a Semicolon to the existing value.
Then paste the copied location.Then OK, OK, OK.
]
Paste the copied location inside Variable Value.
Click on OK ,OK OK
3. Write Python code to notepad.
Now check whether python is install properly and path is set or not .
Open Command -
Hence path is set properly.
Create a folder on Desktop with any name. ["Python Programs" in my case]
In the address bar type "cmd" and hit Enter.
Type "notepad First.py" [without double quotes] in the Command prompt.
In the notepad write your Python code -
print("Hello World")
Save this file. (Ctrl + S)
Now go to the command prompt.
4. Run the python script from command prompt.
Type python First.py (python name_of_file.py)
Python programs have .py extension.
You will see Hello World in the Python command prompt.
Thanks for watching ...
On this page of the site you can watch the video online 2. Write Python Script to Notepad and execute from Command Prompt with a duration of hours minute second in good quality, which was uploaded by the user Manish Kumar 14 August 2017, share the link with friends and acquaintances, this video has already been watched 9,439 times on youtube and it was liked by 69 viewers. Enjoy your viewing!