安装python ldap以单独安装python

2024-10-06 12:01:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我在将python ldap安装到单独的python安装时遇到一些问题。基本上不应该删除Python2.4,因为系统(linux redhat)依赖于它,所以我将2.7安装在/srv/Python2.7中的一个单独位置。看起来好像已经为2.7安装了PythonLDAP,因为我可以在/srv/python2.7/bin/build/python-ldap中看到一些文件夹和文件。但当我运行脚本时,它抱怨找不到ldap导入。当我再次尝试安装pythonldap时,假设它没有正确安装,我得到以下输出。我的意思是安装pythonldap的所有前提条件都在系统上,比如python2.4+、Openldap、sasl。在

pythonldap在2.4中工作得很好,我可以看到/usr/bin/build/pytholdap中的相关文件与/srv/python2.7/bin/build/pytholdap中的2.7文件相同。。。我还在脚本顶部调用正确的python解释器。还尝试使用pip安装/srv/python2.7/bin/python/usr/bin/pip安装python ldap,但也失败了。在

在[根@统计python ldap]#/usr/local/bin/python设置.py安装

defines: HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R
extra_compile_args:
extra_objects:
include_dirs: /opt/openldap-RE24/include /usr/include/sasl /usr/include
library_dirs: /opt/openldap-RE24/lib /usr/lib
libs: ldap_r
running build
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 -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.10 -IModules -I/opt/openldap-RE24/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/Modules/LDAPObject.o
In file included from Modules/LDAPObject.c:18:
/usr/include/sasl/sasl.h:349: warning: function declaration isnât a prototype
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.10 -IModules -I/opt/openldap-RE24/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: In function âencode_assertion_controlâ:
Modules/ldapcontrol.c:352: warning: implicit declaration of function âldap_create_assertion_control_valueâ
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.10 -IModules -I/opt/openldap-RE24/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.10 -IModules -I/opt/openldap-RE24/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: error: âLDAP_OPT_DIAGNOSTIC_MESSAGEâ undeclared (first use in this function)
Modules/constants.c:155: error: (Each undeclared identifier is reported only once
Modules/constants.c:155: error: for each function it appears in.)
Modules/constants.c:365: error: âLDAP_CONTROL_RELAXâ undeclared (first use in this function)
error: command 'gcc' failed with exit status 1

Tags: pybuildmodulesforincludelibusrnot
1条回答
网友
1楼 · 发布于 2024-10-06 12:01:46

这显然是要安装的pythonldap版本和已安装的OpenLDAP版本之间的不匹配。一般来说,您希望安装最新的pythonldap和一个体面的OpenLDAP版本。猜测:你的OpenLDAP安装太旧了。您可能希望在不同的路径中安装较新版本的OpenLDAP,并使用此版本重新编译python ldap,或者搜索适合已安装OpenLDAP版本的旧python ldap版本。在

相关问题 更多 >