【问题标题】:Centos 5 Python 2.7, Cannot install Python-LDAPCentos 5 Python 2.7,无法安装 Python-LDAP
【发布时间】:2014-01-12 03:58:03
【问题描述】:

我需要安装 * Python-LDAP 在 Ptython 2.7 下运行

我有一个 Centos 5.8 系统(我无法升级到 6.x)。我目前安装了 Python 2.4 和 Python 2.7。我正在使用 Python 2.7 进行开发(连同 Django)。我安装了 Python-LDAP 并在 Python 2.4 下工作(它是使用 yum 安装的)。我需要安装 Python-LDAP 以用于 Python 2.7(我还将安装 Django-ldap)。我已经尝试了好几天来做到这一点。 yum 只能在 Python 2.4 下运行,所以我不能使用它。我从https://pypi.python.org/pypi/python-ldap/ 下载了 Python-LDAP 源代码(python-ldap-2.4.13.tar.gz (md5),但是当我尝试构建它时出现错误(见下文)。

有谁知道我是否/如何在 Centos 5 上安装 Python-LDAP for Python 2.7?

构建时出错:

python setup.py build

defines: HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R
extra_compile_args:
extra_objects:
include_dirs: /home/sfuller/python-ldap-2.4.13 /usr/lib64/evolution-openldap/include 

/usr/lib/evolution-openldap/include /usr/include/sasl /usr/include library_dirs: /home/sfuller/python-ldap-2.4.13 /usr/lib64/evolution-openldap/lib64 /usr/lib /进化-openldap/lib /usr/lib 库:ldap_r 运行构建 运行 build_py 找不到文件 Lib/ldap.py(用于模块 ldap) 找不到文件 Lib/ldap/controls.py(用于模块 ldap.controls) 找不到文件 Lib/ldap/extop.py(用于模块 ldap.extop) 找不到文件 Lib/ldap/schema.py(用于模块 ldap.schema) 找不到文件 Lib/ldap.py(用于模块 ldap) 找不到文件 Lib/ldap/controls.py(用于模块 ldap.controls) 找不到文件 Lib/ldap/extop.py(用于模块 ldap.extop) 找不到文件 Lib/ldap/schema.py(用于模块 ldap.schema) 运行 egg_info

....

warning: no files found matching 'Makefile'
warning: no files found matching 'Modules/LICENSE'
writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
running build_ext
building '_ldap' extension

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes 

-fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.13 -IModules -I/home/sfuller/python-ldap-2.4.13 -I/usr/lib64/evolution-openldap/include -I/usr /lib/evolution-openldap/include -I/usr/include/sasl -I/usr/include -I/usr/local/include/python2.7 -c Modules/LDAPObject.c -o build/temp.linux-x86_64 -2.7/模块/LDAPObject.o 在 Modules/LDAPObject.c:18:0 包含的文件中: /usr/include/sasl/sasl.h:349:5:警告:函数声明不是原型 [-Wstrict-prototypes]

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.13 -IModules -I/home/sfuller/python-ldap-2.4.13 -I/usr/lib64/evolution-openldap/include -I/usr/lib/evolution-openldap/include -I/usr/include/sasl -I/usr/include -I/usr/local/include/python2.7 -c Modules/ldapcontrol.c -o build/temp.linux-x86_64-2.7/Modules/ldapcontrol.o

Modules/ldapcontrol.c:在函数“encode_assertion_control”中: Modules/ldapcontrol.c:352:5:警告:函数“ldap_create_assertion_control_value”的隐式声明[-Wimplicit-function-declaration]

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.13 -IModules -I/home/sfuller/python-ldap-2.4.13 -I/usr/lib64/evolution-openldap/include -I/usr/lib/evolution-openldap/include -I/usr/include/sasl -I/usr/include -I/usr/local/include/python2.7 -c Modules/common.c -o build/temp.linux-x86_64-2.7/Modules/common.o

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.13 -IModules -I/home/sfuller/python-ldap-2.4.13 -I/usr/lib64/evolution-openldap/include -I/usr/lib/evolution-openldap/include -I/usr/include/sasl -I/usr/include -I/usr/local/include/python2.7 -c Modules/constants.c -o build/temp.linux-x86_64-2.7/Modules/constants.o

Modules/constants.c: In function âLDAPinit_constantsâ:
Modules/constants.c:155:1: error: âLDAP_OPT_DIAGNOSTIC_MESSAGEâ undeclared (first use in 

这个函数) Modules/constants.c:155:1:注意:每个未声明的标识符对于它出现的每个函数只报告一次 Modules/constants.c:365:29: error: âLDAP_CONTROL_RELAXâ undeclared (第一次在这个函数中使用) 错误:命令“gcc”失败,退出状态为 1


然后我查看了这个帖子:https://mail.python.org/pipermail/python-ldap/2011q2/002937.html

于是我下载了最新的 OpenLDAP 并得到:

./configure
Configuring OpenLDAP 2.4.38-Release ...
...
configure: error: BerkeleyDB version incompatible with BDB/HDB backends

好像我只是下沉到黑洞中......

【问题讨论】:

标签: python django python-2.7 ldap centos5


【解决方案1】:

这在 centos 5.10python 2.7.6 中有效。我安装成virtualenv

我在你的日志中看到提到evolution-openldap,当我遇到同样的问题时,这些都在我的日志中。这些目录由openldap 2.3x 安装。

您不需要从源代码构建 openldap,因为 yum 中有一个新版本足以满足 python-ldap 的版本要求。

openldap24-libs.i386                 2.4.23-5.el5                     
openldap24-libs.x86_64               2.4.23-5.el5                     
openldap24-libs-devel.i386           2.4.23-5.el5                     
openldap24-libs-devel.x86_64         2.4.23-5.el5             

要安装你应该首先yum install openldap24-libs openldap24-libs-devel

编辑 setup.cfg 使其 [_ldap] 部分包含:

library_dirs = /usr/lib/openldap24
include_dirs = /usr/include/openldap24

再次运行构建。 (我删除了旧的 build/ 目录,如果上述方法不起作用,您可能不需要,但试一试)。

【讨论】:

    猜你喜欢
    • 2017-09-13
    • 2011-06-13
    • 2019-11-30
    • 2018-07-16
    • 1970-01-01
    • 2018-04-16
    • 1970-01-01
    • 2022-06-21
    • 2018-03-29
    相关资源
    最近更新 更多