Building and installing

python-ldap is built and installed using the Python DistUtils installed along with your Python installation:

python build
python install

If you have more than one Python interpreter installed locally you should use the same one you plan to use python-ldap with.

See further instructions for using DistUtils here:


The following software packages are required to be installed on the local system when building python-ldap:

Furthermore some sub-modules of ldap.controls and ldap.extop require pyasn1 and pyasn1_modules to be installed.


The file setup.cfg allows to set some build and installation parameters for reflecting the local installation of required software packages. Only section [_ldap] is described here. More information about other sections can be found in the documentation of Python’s DistUtils.


Specifies in which directories to search for required libraries.


Specifies in which directories to search for include files of required libraries.


A space-separated list of library names to link to (see Libs used).


Compiler options.


Libs used


The LDAP protocol library of OpenLDAP. ldap_r is the reentrant version and should be preferred.


The BER encoder/decoder library of OpenLDAP.


The Cyrus-SASL library if needed and present during build


The SSL/TLS library of OpenSSL if needed and present during build


The basic cryptographic library of OpenSSL if needed and present during build


The following example is for a full-featured build (including SSL and SASL support) of python-ldap with OpenLDAP installed in a different prefix directory (here /opt/openldap-2.3) and SASL header files found in /usr/include/sasl. Debugging symbols are preserved with compile option -g.

library_dirs = /opt/openldap-2.3/lib
include_dirs = /opt/openldap-2.3/include /usr/include/sasl

extra_compile_args = -g
extra_objects =

libs = ldap_r lber sasl2 ssl crypto

Table Of Contents

Previous topic

python-ldap Documentation

Next topic

ldap LDAP library interface module

This Page