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.
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
This folder you created is referred to generically as WORKSHOP below.
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
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.
Terminal.app. At the time of writing, the choices are:
We're going to want to launch IDLE from within the WORKSHOP directory.
This should work by default.
Terminal.app from the Applications menu, and type:
Where WORKSHOP is replaced by the directory you chose to use for the workshop. Now type:
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
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:
File -> Save and enter
hw.py for the filename.
Run -> Run Module to run the script:
You have now written and run a Python script.