我正在尝试在 cygwin 下安装基本的 ldap python 模块。以下失败:
%easy_install ldap
Searching for ldap...
..
No local packages or download links found for ldap
我正在为一个在 Ubuntu 中运行良好的应用程序使用 cherrypy,并计划将其移植到 cygwin 以便我可以在我的 Win7 笔记本电脑上运行该应用程序。
(我可以安装特定于 Django 的模块 django-auth-ldap,并尝试将其作为 ldap 导入,但这似乎没有基本 ldap 模块所具有的初始化方法。)
PS:我忘了提到尝试使用 python-ldap,但是“easy_install python-ldap”由于一些编译错误而失败:
.....
.....
Modules/constants.c: In function `LDAPinit_constants':
Modules/constants.c:153:1: error: `LDAP_OPT_DIAGNOSTIC_MESSAGE' undeclared (first use in this function)
Modules/constants.c:153:1: note: each undeclared identifier is reported only once for each function it appears in
Modules/constants.c:363:29: error: `LDAP_CONTROL_RELAX' undeclared (first use in this function)
error: Setup script exited with error: command 'gcc' failed with exit status 1
最佳答案
另一个 stackoverflow 页面来拯救:python-ldap OS X 10.6 and Python 2.6
最终解决方案:
pip install python-ldap==2.3.13
在此处注明,以便在 cygwin 中遇到此问题的人可以使用这篇文章。
关于python - cygwin下安装python ldap模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7466959/