You will need:

The L293D driver chips are very cheap to buy: I bought a bag of five from Amazon. Unless you intend to use more than two motors, only one driver chip is required; each L293D can drive up to two motors.

1. Powering the L293D chip

Power and ground setup - the chip should bridge the middle of the breadboard:

pin numbering image

The circuit should look like this:

power pins image

2. Data wires

The GPIO pins used in this example can be substitued for other valid pins, as long as continuity is maintained when setting up a Python script.

The Pi's GPIO needs to be wired to the L293D's data pins via the breadboard, as follows:

Your circuit should now look something like this:

data pins image

3. Adding a motor

one motor image

You will also need to connect the battery pack to the power rail and the common ground rail - the one that connects to the L293D's pin 8.

Note: It doesn't matter which motor wire is connected to 3 or 6, although this will affect the direction. When you've set up a Python script, if clockwise() makes the motor spin anti-clockwise, the two motor wires should be swapped.

4. Adding another motor (optional)

This is similar to how the first motor was connected, but the other side of the chip is used.

Data wires:

Motor wires:

The circuit should now look something like this:

two motors image

More motors can be used with additional L293Ds. Just set up another chip as demonstrated above - each chip can drive a maximum of 2 motors.