python - cygwin下安装python ldap模块

标签 python cygwin

我正在尝试在 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/

相关文章:

python - str.format() 选项不起作用

python - SQLAlchemy 删除级联失败

java - 如何在cygwin中快速切换JDK?

python: 在 cygwin 上使用 ctypes 时出现 sigsegv

python - 如何从 shell 启动和停止 Python 脚本

python - 计算两个文档之间的对称 Kullback-Leibler 散度

git - 如何在 cygwin(和一些 linux 发行版)上将企业证书颁发机构 (CA) 添加到 git

ssh - 主机未从配置文件加载

node.js - 在 cygwin 中更新 nodejs

python isinstance(n, int) 和 int(n) == n