Python                                                          Home : www.sharetechnote.com

 

 

 

 

How to Run ?

 

There are many different ways to run Python command as listed below. In my case, I mostly use the second or third method since I like the pure text based and light tool, but depending on your preference or application you may prefer other / heavier tools.

 

 

 

< 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 filename.py (In this example, I saved file as HelloWorld.py)

 

 

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 filename.py' in python.exe path is set in your operating system path setting. If 'python.exe filename.py' 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.

 

 

 

 

< Run in Browser : Jupyter/IPython >

 

You can run Python in your Web Browser as shown below. But you need to install an additional tool called Jupyter. For Jupyter installation and execution, refer to Jupyter page.

 

 

 

 

< Run in Anaconda >

 

You can run Python with an IDE(Integrated Development Environment) called Anaconda. See Anaconda introduction page for further details.