I have cracked this issue & now everything is working fine.
While installing Postgresql I was missing the step ‘Install all headers’ &
also while installing psycopg I was missing the last step i.e. to import
psycopg in python.
Also I exported ‘LD_LIBRARY_PATH’ variable after giving it the appropriate
value.