This problem was tough to hunt down and various instructions didn’t work. Switching to 32 bit python did not work.
Here’s what did work for OSX 10.6.8, Postgresql and psycopg2 2.4.2
1. Download the source Psycopg2 from http://initd.org/psycopg/download/
2. Extract the tarball and cd into the directory.
3. Run easy_install on the directory (do NOT run easy_install psycopg2) – run `easy_install .`
4. Done.
I also modified the setup.cfg file line pg_config to the directory returned by `which pg_config` BUT it occurs to me that the line was commented out – so the solution must be to run easy_install on the latest version.