These are the steps to be followed to install python-ldap in Ubuntu. At first,
sudo apt-get install python-ldapwould throw the following error
In file included from Modules/LDAPObject.c:4:0:To get past this error, we need to install python-dev package
Modules/common.h:10:20: fatal error: Python.h: No such file or directory compilation terminated.
error: command 'gcc' failed with exit status 1
sudo apt-get install python-devAfter installing that we ll get the following error
In file included from Modules/LDAPObject.c:9:0:To get past this error, we need to install ldap2-dev package
Modules/errors.h:8:18: fatal error: lber.h: No such file or directory
compilation terminated.
sudo apt-get install libldap2-devAfter installing that we ll get the following error
Modules/LDAPObject.c:18:18: fatal error: sasl.h: No such file or directory compilation terminated.To get past this error, we need to install libsasl2-dev package
error: command 'gcc' failed with exit status 1
sudo apt-get install libsasl2-devAfter that
sudo apt-get install python-ldapshould install python-ldap without any problems.