gpt4 book ai didi

python - pypokereval 库配置脚本失败,出现 "No python development environments found"

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:55:24 24 4
gpt4 key购买 nike

我正在尝试为 python2.7(mint linux 上的默认设置)编译 pypoker-eval-138.0 库:

因此,当通过 ./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 版本:

ls /usr/bin/python*
/usr/bin/python (/usr/bin/python -> python2.7)
/usr/bin/python2-dbg-config
/usr/bin/python2 /usr/bin/python3
/usr/bin/python2.7 /usr/bin/python3.3
/usr/bin/python2.7-config /usr/bin/python3.3m
/usr/bin/python2.7-dbg /usr/bin/python3m
/usr/bin/python2.7-dbg-config /usr/bin/python-config
/usr/bin/python2-config /usr/bin/python-dbg
/usr/bin/python2-dbg /usr/bin/python-dbg-config

我也尝试过 ./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?我是否必须重新生成配置脚本,或者我是否可以将一些标志或变量传递给配置脚本以强制构建 2.7?

非常感谢!

最佳答案

好吧,这是一个挑战(一个人可以为声誉做些什么?:)。

提示在更新日志中

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

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

所以应该只修复这些文件以支持新的 python 版本。我刚刚用 python 2.7 替换了 python 2.5,用 autoreconf 重新配置并且它工作了。请参阅下面的完整补丁。

要使其正常工作,请确保安装了这些软件包:

$ apt-get install python-dev autoconf pkg-config

应用下面的补丁并运行

$ autoreconf
$ ./configure
$ make

这是补丁(好吧,我也必须更改 Makefile.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],[],[

关于python - pypokereval 库配置脚本失败,出现 "No python development environments found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20338472/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com