pypokereval库配置脚本失败,原因是“找不到python开发环境”

2024-09-27 07:23:51 发布

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

我试图为python2.7编译pypoker-eval-138.0库(mint linux上的默认值):

因此,当通过./configure运行configure脚本时,我得到关于python解释器版本的错误:

    ...snip...
checking for a Python interpreter with version =2.3... done
checking for a Python interpreter with version =2.4... done
checking for a Python interpreter with version =2.5... done
checking for a Python interpreter with version =2.6... done
configure: error: No python development environments found

我安装的python版本:

^{pr2}$

我也尝试过./configure PYTHON="/usr/bin/python2.7"和类似的方法,但在上述问题上遇到了变体:

 ...snip..
 checking whether to enable maintainer-specific portions of Makefiles... no
 checking whether /usr/bin/python2.7 version =2.3... configure: error: too old

为了解决这个问题,我花了大量的时间尝试更改aclocal/autoconf设置,但不太熟悉应该做什么。我有以下.m4文件,我尝试过编辑,但都有不同程度的失败:

 ls ./aclocal.m4 ./config/*
 ./aclocal.m4           ./config/install-sh      ./config/ltsugar.m4
 ./config/ccpython.m4   ./config/libtool.m4      ./config/ltversion.m4
 ./config/config.guess  ./config/ltmain.sh       ./config/missing
 ./config/config.sub    ./config/lt~obsolete.m4  ./config/py-compile
 ./config/depcomp       ./config/ltoptions.m4    ./config/python.m4

例如,./config/ccpython.m4

 ...snip..
 AC_DEFUN([ALL_CC_PYTHON],
 [ 
 m4_define([_AM_PYTHON_INTERPRETER_LIST], [python2.6 python2.5 python2.4 python2.3])
 PYTHONS=''
 found_one=''
 _ONE_CC_PYTHON([=2.3], [2_3])
 if test -f "$PYTHON" ; then found_one=$PYTHON ; PYTHONS="$PYTHON $PYTHONS" ; fi
 unset PYTHON
 ...snip..

我的问题是,特别是:如何为2.7编译一个python模块,它有一个只支持2.6的configure脚本?我是必须重新生成配置脚本,还是可以只向配置脚本传递一些标志或变量来强制构建2.7版本?在

多谢了!在


Tags: 版本脚本configforversionconfigurewithsnip
2条回答

好吧,这是一个挑战(一个人能为名誉做些什么?:). 在

提示在Changelog中

    * config/python.m4 (AM_PATH_PYTHON): Added python2.6 support.

    * config/ccpython.m4 (ALL_CC_PYTHON): Added python2.6 support.

所以它应该只修复这些文件来支持新的python版本。我刚刚用Python2.7替换了Python2.5,用autoreconf重新配置了它,它就起作用了。请参阅下面的完整补丁。在

要使其正常工作,请确保已安装以下软件包:

^{pr2}$

应用下面的补丁并运行

$ autoreconf
$ ./configure
$ make

这是补丁(嗯,我得换了生成文件.am以及):

diff  git a/Makefile.am b/Makefile.am
index c16df82..7d66971 100644
 - a/Makefile.am
+++ b/Makefile.am
@@ -40,12 +40,12 @@ _pokereval_2_6_la_LIBADD = ${PYTHON2_6_LIBS} ${POKER_EVAL_LIBS}
 _pokereval_2_6_la_CFLAGS = ${PYTHON2_6_CFLAGS} ${POKER_EVAL_CFLAGS} -DPYTHON_VERSION=\"2_6\" -D'VERSION_NAME(w)=w\#\#2_
 endif

-if PYTHON_2_5
-py2_5exec_LTLIBRARIES = _pokereval_2_5.la
-_pokereval_2_5_la_SOURCES = pypokereval.c
-_pokereval_2_5_la_LDFLAGS = -module -no-undefined -version-info 1:0:0
-_pokereval_2_5_la_LIBADD = ${PYTHON2_5_LIBS} ${POKER_EVAL_LIBS}
-_pokereval_2_5_la_CFLAGS = ${PYTHON2_5_CFLAGS} ${POKER_EVAL_CFLAGS} -DPYTHON_VERSION=\"2_5\" -D'VERSION_NAME(w)=w\#\#2_
+if PYTHON_2_7
+py2_7exec_LTLIBRARIES = _pokereval_2_7.la
+_pokereval_2_7_la_SOURCES = pypokereval.c
+_pokereval_2_7_la_LDFLAGS = -module -no-undefined -version-info 1:0:0
+_pokereval_2_7_la_LIBADD = ${PYTHON2_7_LIBS} ${POKER_EVAL_LIBS}
+_pokereval_2_7_la_CFLAGS = ${PYTHON2_7_CFLAGS} ${POKER_EVAL_CFLAGS} -DPYTHON_VERSION=\"2_7\" -D'VERSION_NAME(w)=w\#\#2_
 endif

 if PYTHON_2_4
diff  git a/config/ccpython.m4 b/config/ccpython.m4
index c94cbb6..46de0db 100644
 - a/config/ccpython.m4
+++ b/config/ccpython.m4
@@ -110,7 +110,7 @@ AM_CONDITIONAL([PYTHON_]$2, [test "$have_python" != "no"])

 AC_DEFUN([ALL_CC_PYTHON],
 [ 
-m4_define([_AM_PYTHON_INTERPRETER_LIST], [python2.6 python2.5 python2.4 python2.3])
+m4_define([_AM_PYTHON_INTERPRETER_LIST], [python2.6 python2.7 python2.4 python2.3])
 PYTHONS=''
 found_one=''
 _ONE_CC_PYTHON([=2.3], [2_3])
@@ -119,7 +119,7 @@ unset PYTHON
 _ONE_CC_PYTHON([=2.4], [2_4])
 if test -f "$PYTHON" ; then found_one=$PYTHON ; PYTHONS="$PYTHON $PYTHONS" ; fi
 unset PYTHON
-_ONE_CC_PYTHON([=2.5], [2_5])
+_ONE_CC_PYTHON([=2.7], [2_7])
 if test -f "$PYTHON" ; then found_one=$PYTHON ; PYTHONS="$PYTHON $PYTHONS" ; fi
 unset PYTHON
 _ONE_CC_PYTHON([=2.6], [2_6])
diff  git a/config/python.m4 b/config/python.m4
index c8c5e30..4d0366e 100644
 - a/config/python.m4
+++ b/config/python.m4
@@ -42,7 +42,7 @@ AC_DEFUN([AM_PATH_PYTHON],
   dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
   dnl in 1.5.
   m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
-                      [python python2 python2.5 python2.6 python2.4 python2.3 python2.2 dnl
+                      [python python2 python2.7 python2.6 python2.4 python2.3 python2.2 dnl
 python2.1 python2.0 python1.6 python1.5])

   m4_if([$1],[],[

您可以尝试从源代码http://www.python.org/download/releases/2.6.9/安装python2.6

或者试用pyenvhttps://github.com/yyuu/pyenv

相关问题 更多 >

    热门问题