1) Introduction

We'll be using Python frequently in class, and it'll save lots of time if everyone has this installed and is familiar how to open, edit, and run a script (which is just a text file) using Python.

Furthermore, we'll be using IDLE, Python's own IDE (Integrated Development Environment). The workshop does not rely on any of IDLE's specific features, but it makes setting up Python much easier and provides a multi-platform basis for examples.

2) Create a Folder for Workshop Files

Create a folder for all your python code and other files. If using Windows, create a folder at C:\Documents and Settings\MY_USERNAME\My Documents\workshop (Windows). For Mac users, create this folder at ~/workshop (Mac/Linux). This folder you created is referred to generically as WORKSHOP below.

3) Install Python (and IDLE)

We will be using version 3.4.3 of Python in this class.


Python and IDLE are not installed by default.

IDLE (Python GUI) and Python (command line) should now by in your program menu, under Python 3.4, and Python will be associated with .py files. However they're going to need to know about the files we create during the workshop. This is easiest if we start IDLE from the WORKSHOP folder itself. Let's create a Windows script, idle.bat that does that:

You should now be able to double-click idle.bat to open IDLE.


Python and IDLE are both installed by default on recent Macs, but they are older versions. Follow these instructions for a Mac binary install, or install from source, using the instructions further down the page.

We're going to want to launch IDLE from within the WORKSHOP directory. This should work by default. Open up Terminal.app from the Applications menu, and type:


Where WORKSHOP is replaced by the directory you chose to use for the workshop. Now type:

idle3 &

and hit ENTER to launch IDLE.


Note: Please ask a TA for help in updating to the most recent python version; these instructions are for an older version.

Python is installed by default, but sometimes IDLE is not. Either install IDLE using your distro's package manager, e.g. apt-get install idle (Ubuntu/Debian/etc.), yum install python26-tools (RHEL/CentOS/etc.), USE=tk emerge -avn python (Gentoo), etc., or install new version of Python from source (which will include IDLE).

Launching IDLE from the WORKSHOP directory will be the same as for the Mac case above (just use your favorite terminal instead of Terminal.app).

4) Try IDLE

You should now have an IDLE session open that looks something like this:

This is where we'll pick up the workshop. If you're feeling ambitious, try creating a Python script by clicking File -> New Window, which will open a text editor window, and enter the following line:

Click File -> Save and enter hw.py for the filename. Then click Run -> Run Module to run the script:

You have now written and run a Python script.