Running Python on your OS

Run the Python command-line interpreter, under your OS of choice,

Windows
  • Open Command line:   Start menu -> Run  and type cmd
  • Type:   C:\python27\python.exe
  • Note: This is the default path for Python 2.7. If you are using a computer where Python is not installed in this path, change the path accordingly.
Mac OS X
  • Open Command line:   Finder -> Go menu -> Applications -> Terminal
  • Type: python
Linux
  • Open a command prompt (e.g. xterm)
  • Type: python

Using the IDLE interpreter:

Windows
  • Start IDLE:   Start menu -> Programming -> Python 2.7 -> IDLE (Python GUI)
  • (alternatively, press Start menu and start typing "idle" and click when it appears.)
Mac OS X
  • Start IDLE:   Finder -> Go menu -> Applications -> IDLE
  • (alternatively, it may be found under MacPorts. Or use SpotLight to search for "IDLE".)
Linux
  • Open a command prompt (e.g. xterm)
  • Type: idle

Run any plain text editor

Windows
  • Start Notepad:   Start menu -> Accessories -> Notepad
Mac OS X
  • Start TextEdit:   Finder -> Go menu -> Applications -> TextEdit
  • Alternative: Start TextWrangler:   Finder -> Go menu -> Applications -> TextWrangler
Linux
  • Start nano: open a command prompt and type nano
  • Alternative: Start gedit: open a command prompt and type gedit

Run your script

Suppose your script is in "Z:\code\hw01\script.py" or ~/code/hw01/script.py on Unix-like systems.

Windows
  • Open Command line:   Start menu -> Run  and type cmd
  • Type:   C:\python27\python.exe Z:\code\hw01\script.py
  • Or if your system is configured correctly, you can drag and drop your script from Explorer onto the Command Line window and press enter.
Mac OS X
  • Open Command line:   Finder -> Go menu -> Applications -> Terminal
  • Type: python ~/code/hw01/script.py
Linux
  • Open a command prompt (e.g. xterm)
  • Type: python ~/code/hw01/script.py