2

安装 python-ldap 时出现以下错误。请注意,我的系统上已经设置了 open-ldap、berkely db。我遵循的步骤是:

tar xvf python-ldap-2.4.10.tar.gz\
cd python-ldap-2.4.10\
#edit setup.cfg\
#library_dirs = /nlu/users/prefix /usr/lib\
#include_dirs = /nlu/users/prefix /usr/include/sasl /usr/include\
python setup.py install\

我收到以下错误。

python setup.py install
defines: HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R
extra_compile_args:
extra_objects:
include_dirs: /nlu/users/prefix/include /usr/include/sasl /usr/include
library_dirs: /nlu/users/prefix/lib /usr/lib
libs: ldap_r
running install
running bdist_egg
running egg_info
writing requirements to Lib/python_ldap.egg-info/requires.txt
writing Lib/python_ldap.egg-info/PKG-INFO
writing top-level names to Lib/python_ldap.egg-info/top_level.txt
writing dependency_links to Lib/python_ldap.egg-info/dependency_links.txt
file Lib/ldap.py (for module ldap) not found
file Lib/ldap/controls.py (for module ldap.controls) not found
file Lib/ldap/extop.py (for module ldap.extop) not found
file Lib/ldap/schema.py (for module ldap.schema) not found
reading manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'Makefile'
warning: no files found matching 'Modules/LICENSE'
writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
file Lib/ldap.py (for module ldap) not found
file Lib/ldap/controls.py (for module ldap.controls) not found
file Lib/ldap/extop.py (for module ldap.extop) not found
file Lib/ldap/schema.py (for module ldap.schema) not found
file Lib/ldap.py (for module ldap) not found
file Lib/ldap/controls.py (for module ldap.controls) not found
file Lib/ldap/extop.py (for module ldap.extop) not found
file Lib/ldap/schema.py (for module ldap.schema) not found
running build_ext
building '_ldap' extension
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -     I/nlu/users/indrani_gorti/prefix/include -fPIC -I/nlu/users/indrani_gorti/prefix/include -     fPIC -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -     DLDAPMODULE_VERSION=2.4.13 -IModules -I/nlu/users/prefix/include -  I/usr/include/sasl -I/usr/include -I/nlu/users/prefix/include/python2.7 -c       Modules/LDAPObject.c -o build/temp.linux-x86_64-2.7/Modules/LDAPObject.o
Modules/LDAPObject.c:18:18: error: sasl.h: No such file or directory
Modules/LDAPObject.c:553: error: expected declaration specifiers or '...' before     'sasl_interact_t'
Modules/LDAPObject.c: In function 'interaction':
Modules/LDAPObject.c:562: error: 'interact' undeclared (first use in this function)
Modules/LDAPObject.c:562: error: (Each undeclared identifier is reported only once
Modules/LDAPObject.c:562: error: for each function it appears in.)
Modules/LDAPObject.c: In function 'py_ldap_sasl_interaction':
Modules/LDAPObject.c:607: error: 'sasl_interact_t' undeclared (first use in this    function)
Modules/LDAPObject.c:607: error: 'interact' undeclared (first use in this function)
Modules/LDAPObject.c:607: error: expected expression before ')' token
Modules/LDAPObject.c:610: error: 'SASL_CB_LIST_END' undeclared (first use in this  function)
Modules/LDAPObject.c:612: error: too many arguments to function 'interaction'
error: command 'gcc' failed with exit status 1
4

1 回答 1

0

pip使用 python 包索引来安装 ldap可能是个好主意。只需键入:

pip install python-ldap

在命令提示符下。或者,如果您需要管理员权限,

sudo pip install python-ldap
于 2013-08-01T21:04:40.617 回答