Python                                                          Home :





How to Run ?


There are a couple of different ways to run Python command. One is to run the command within Python interpreter and the other one is to run it as script file.



< Run in Python Interpreter >


If you run python.exe, you will get Python Interpreter running as shown below. Then you can type in Python command and Press Enter to get the result. Try type in print("Hello World") and press Enter



If you installed the recent Python version (e.g, Python 3.x), you may see Python.exe icon in Windows button as shown below (I am using Windows 7) and just click the Python menu to get Python Interpreter running.




< Run in Python IDLE >


If you installed a relatively later version of Python, you would see another type of scripting(coding) environment as shown below (named 'IDLE' meaning 'Integrated DevLopment Environment').


you can run Python command by typing in at the command line as follows or by writing / running a *.py (Python script file)



In IDLE, you can create a py file (Python Script file) and run it as shown below.


Create a new file in File menu



Write a Python script as you like and execute [Run Module] (NOTE : a Popup may show up asking for file save. Save the file then)



< Run as Python Script >


In most case, you may write a sequence of Python command in a file and run the file as explained in this section.


First, create a Python script as shown below. You can use any text editor like notepad or Python scriptor Editor "IDLE" or any other text editor. Save the file as (In this example, I saved file as



Once you created the python script file, you can just double click the file to run it. (This double click may or may not work depending on which version of Python you are using or configurations in your Operating System).


In most case, you may run as follows. Run windows command and go to the folder where your script is located and type in 'python.exe' in python.exe path is set in your operating system path setting. If 'python.exe' does not work, you have to specify full path for python.exe as shown below.

NOTE : You would not like to put this kind of long file path every time you run the script. In that case, you can add the python file path in Windows System configuration.  The best way is to Check "Add Python x.x to PATH" when you install Python and the installation program will add the path automatically.