Using Python on Windows

From BITS wiki
Jump to: navigation, search
DISCLAIMER: This is only valid if you are using the IDLE editor. Please ignore if you are using spyder in Anaconda

Introduction

All you need to execute a Python program is the Python 'interpreter', which can be invoked in different ways. To make life easier for you, there is a graphical user interface called IDLE available on Windows and Mac - we will be using this to write the programs and execute them.

Installation

You can download Python installation files from http://www.python.org/ for Windows and Mac. Note: on Linux, Python is installed by default, and a very nice editor is Geany. Go to the downloads page and download the installer for your Windows platform:

  • Python 2.7.2 Windows Installer (Windows binary -- does not include source)
  • Python 2.7.2 Windows X86-64 Installer

Execute the installer the normal way.

Preparation

  • First, create a directory on the desktop called pythonCourse or something similar. We will store all the programs in here.
  • Start up IDLE (either from desktop icon if available or from bottom left corner menu)
  • You should get a 'Python shell' window. In here go to File->New Window.
  • You should now get another window - use this to write your first program in.
  • To execute the code you wrote in the new window, press F5.
  • At this stage you should get something like the image below.
  • You can then save the program from File->Save in the pythonCourse directory.

IDLE screen shot.png

Back to main page