When building Python 3.2.3 from source on Ubuntu 12.04, the zlib module is not available.
I downloaded the official source distribution from python.org, and attempte
sudo apt-get install zlib1g-dev
is what worked for me.