pythonmoduleldappython-ldap

I can't install python-ldap


When I run the following command:

sudo pip install python-ldap

I get this error:

In file included from Modules/LDAPObject.c:9:

Modules/errors.h:8: fatal error: lber.h: No such file or directory

How can I fix this?


Solution

  • The python-ldap is based on OpenLDAP, so you need to have the development files (headers) in order to compile the Python module. If you're on Ubuntu, the package is called libldap2-dev.

    Debian/Ubuntu:

    sudo apt-get install libsasl2-dev python-dev-is-python3 libldap2-dev libssl-dev
    

    Red Hat/CentOS:

    sudo yum install python-devel openldap-devel