This chapter leads the user through the installation and testing of the NumTut package, which should have been distributed with this document.
This tutorial assumes that the NumTut package has been installed. If it hasn't, see below, Possible reasons for failure). This package contains a few sample images and utility functions for displaying arrays and the like. To find out if NumTut has been installed, do:
If a picture of a greek street shows up on your screen, you're all set, and you can go to the next chapter.
ImportError: No module named NumTut
This message indicates that you do not have the NumTut package installed in your PythonPath. NumTut is distributed along with the Numeric source distribution in the Demo subdirectory. It also is available at SourceForge as a separate download. Copy the NumTut subdirectory somewhere into your Python path, or just execute python from the Demo directory.
If you have installed Numeric from a binary distribution, NumTut may not be included. Get the source distribution for the tutorial.
On Win32, the NumTut directory can be placed in the main directory of your Python installation. On Unix, it can be placed in the site-packages directory of your installation.
ConfigurationError: view needs Tkinter on Win32, and either threads or the IDLE editor"
ConfigurationError: view needs either threads or the IDLE editor to be enabled.
On Win32 (Windows 95, 98, NT), the Tk toolkit is needed to view the images. Additionally, either the Python interpreter needs to be compiled with thread support (which is true in the standard win32 distribution) or you need to call the NumTut program from the IDLE interactive development environment.
If you do not wish to modify your Python installation to match these requirements, you can simply ignore the references to the demonstrations which use the view() command later in this document. Using NumPy does not require image display tools, they just make some array operations easier to understand.
On Unix machines, NumTut will work best with a Python interpreter with Tk support (not true in the default configuration), with the Tkinter GUI framework available and optionally with the tkImaging add-on (part of the Python Imaging Library). If this is not the case, it will try to use an external viewer which is able to read PPM files. The default viewer is 'xv', a common image viewer available from ftp://ftp.cis.upenn.edu/pub/xv. If xv is not installed, you will get an error message similar to:
ConfigurationError: PPM image viewer 'xv' not found
You can configure NumTut to use a different image viewer, by typing e.g.:
>>> NumTut.view.PPMVIEWER = 'ppmviewer'
If you do not have a PPM image viewer, you can simply ignore the references to the demonstrations which use the view() command later in this document. Using NumPy does not require image display tools, they just make some array operations easier to understand.