Installing the Required Software
All of the Python software used in this text is free and open source. The following sections provide pointers about where to find the software as well as some links to instructions for installing this software. As software is always a moving target and the versions of Python and some of the modules used in this text are bound to change, we will not try to give you specific instructions for installing Python on every operating system and platform.
The latest version of Python is always available from www.python.org. Click on the Download link, and follow the instructions for your operating system to install the latest version of Python.
If you are running Windows, you will need to download and install Python. After downloading the installation file, double-click the file to execute it. We recommend checking the box so that Python updates the path and also accepts long filenames.
If you have a Mac and are using OS X 10.5 or a later version, an older version of Python (2.x) is already installed on your machine. However, many of the examples in this text will not run with this older version. We strongly recommend that you install Python version 3.8 or later. Do not uninstall the earlier version, however, because some Apple and third-party software use the earlier version.
If you are running Linux, chances are very good that you already have Python installed. You can see what version you have installed by typing the command
from the command line.
If Python 3.x is not installed on your Linux box, you will need to download and install it.
cImage
The image library used in Chapter 6 relies on two Python modules. The first module you will need for image processing is cImage.py
. This module is available from http://knuth.luther.edu/~bmiller/python.html. Clicking the link takes you to the GitHub repository for cImage
.
Alternatively, you can go directly to GitHub (github.com) and search for cImage
. If you are presented with multiple search results, select bnmnetp/cImage
. Download the zipped file, unzip it, and move cImage.py
into the site-packages
folder. In Windows, site-packages
is located in the Lib
folder under Python’s installation folder. If you have trouble finding this folder, simply move cImage.py
into your working folder that contains the Chapter 6 code. Python will be able to find cImage.py
in either location. The cImage
module will work with gif and ppm files with no additional modules required.
The second module, called the Python Image Library, should also be installed. Pillow
allows image processing of jpg files and several other image formats. To install Pillow
, on the command line, type:
18.217.206.10