簡體   English   中英

Centos 5 Python 2.7,無法安裝Python-LDAP

[英]Centos 5 Python 2.7, Cannot install Python-LDAP

我需要安裝* 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 2.7安裝Python-LDAP?

構建時出錯:

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 / evolution -openldap / lib / usr / lib libs:運行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 /Modules/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:錯誤:未聲明“ LDAP_CONTROL_RELAX”(此功能首次使用)錯誤:命令“ 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

好像我正沉入一個黑洞里...

這適用於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 /目錄,如果上面的方法不起作用,您可能不需要這樣做,但可以嘗試一下)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM