I solved this for myself by installing the python headers for my version.
At least this fixes it for the Psycopg2 package.