首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Centos 5 Python 2.7,无法安装Python

Centos 5 Python 2.7,无法安装Python
EN

Stack Overflow用户
提问于 2013-12-23 22:09:05
回答 1查看 2.4K关注 0票数 2

我需要安装*Python,以便在Ptython 2.7下运行。

我有一个CentOS5.8系统(我不能升级到6.x)。我现在已经安装了Python2.4和Python2.7。我正在使用Python2.7进行开发(以及Django)。我安装了Python,并在Python2.4下工作(它是使用yum安装的)。我需要安装Python,以便与Python2.7一起使用(我还将安装Django-ldap)。我已经试了好几天了。yum只在Python2.4下运行,所以我不能使用它。我从md5下载了python源代码(python 2.4.13.tar.gz( https://pypi.python.org/pypi/python-ldap/ )),但是当我试图构建它时,会出现错误(参见下文)。

有人知道我是否可以在Centos 5上安装Python-ldapforPython2.7吗?

在构建时出错:

代码语言:javascript
复制
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 /流变-openldap/include /usr/include/sasl /usr/include library_dirs: /home/sfuller/python 2.4.13 /usr/lib 64/流变-openldap/ Lib 64/usr/Lib/ldap.controls-openldap/Lib/usr/Lib: ldap_r运行构建运行build_py文件Lib/ldap.py (对于模块ldap)找不到文件Lib/ldap/Contros.py(用于模块ldap.controls)/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。

代码语言:javascript
复制
....

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 2.4.13 -I/usr /lib 64/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构建/tem.linux-x86_64-2。7/Modules/LDAPObject.o文件中包含的Modules/LDAPObject.c:18:0: /usr/include/sasl/sasl.h:349:5:警告:函数声明不是一个原型-W-原型

代码语言:javascript
复制
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

模块/ldapcontrol.c.c:在函数âencode_assertion_controlâ中:模块/ldapcontrol.c.c:352:5:警告:函数的隐式声明-âldap_create_assertion_control_valueâ隐式-函数声明

代码语言:javascript
复制
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 

此函数)模块/constants.c:155:1:注意:每个未声明的标识符只报告一次,它出现在Modules/constants.c:365:29:âLDAP_CONTROL_RELAXâuse (在此函数中首次使用)错误:命令'gcc‘失败,退出状态为1。

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

所以我下载了最新的OpenLDAP,得到了:

代码语言:javascript
复制
./configure
Configuring OpenLDAP 2.4.38-Release ...
...
configure: error: BerkeleyDB version incompatible with BDB/HDB backends

好像我正往下沉入黑洞.

EN

回答 1

Stack Overflow用户

发布于 2014-01-16 22:23:56

这在centos 5.10python 2.7.6中起了作用。我安装在一个virtualenv中。

我看到在您的日志中提到了evolution-openldap,当我有同样的问题时,它就在我的日志中。这些目录是由openldap 2.3x安装的。

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

代码语言:javascript
复制
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]部分包含:

代码语言:javascript
复制
library_dirs = /usr/lib/openldap24
include_dirs = /usr/include/openldap24

再运行一次构建。(我删除了我以前的构建/目录,您可能不需要这样做,但是如果上面的内容不起作用,就尝试一下吧)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20751897

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档