问题描述
我正在使用automake的宏 AM_PATH_PYTHON
查找 pythondir
变量.
I am using automake's macro AM_PATH_PYTHON
to find the pythondir
variable.
到目前为止,我一直在不带参数的情况下调用它,在Ubuntu上默认为python 2.7.现在,我还想为 python3.x
(特别是3.3)构建它.
Till now I have been calling it without arguments which defaults to python 2.7 on Ubuntu. Now I also want to build it for python3.x
(3.3 specifically).
有没有一种方法可以调用 AM_PATH_PYTHON([3])
以获取 python3.3
,并使用 AC_SUBST
在特定于 python3
的变量中,然后为 python2
调用 AM_PATH_PYTHON([2])
.
Is there a way where I can call AM_PATH_PYTHON([3])
to get python3.3
, store all the generated variables using AC_SUBST
in a python3
specific variable and then call AM_PATH_PYTHON([2])
for python2
.
我正在这样做
AM_PATH_PYTHON([3])
AC_SUBST(PYTHON3,$PYTHON)
AC_SUBST(HAVE_PYTHON3,$HAVE_PYTHON)
AC_SUBST(PYTHON3_VERSION,$PYTHON_VERSION)
AC_SUBST(PYTHON3_PREFIX,$PYTHON_PREFIX)
AC_SUBST(PYTHON3_EXEC_PREFIX,$PYTHON_EXEC_PREFIX)
AC_SUBST(PYTHON3_PLATFORM,$PYTHON_PLATFORM)
AC_SUBST(python3dir,$pythondir)
AC_SUBST(pkgpython3dir,$pkgpythondir)
AC_SUBST(py3execdir,$pyexecdir)
AC_SUBST(pkgpy3execdir,$pkgpyexecdir)
unset PYTHON
unset HAVE_PYTHON
unset PYTHON_VERSION
unset PYTHON_PREFIX
unset PYTHON_EXEC_PREFIX
unset PYTHON_PLATFORM
unset pythondir
unset pkgpythondir
unset pyexecdir
unset pkgpyexecdir
AM_PATH_PYTHON([2])
在完成所有这些操作之后,第二个 AM_PATH_PYTHON
仍未重写变量.我知道这些是宏,但是应该有一种方法可以做到这一点.Makefile显示
Even after doing all these the second AM_PATH_PYTHON
is not rewriting the variables. I know these are macros, but there should be a way to do this. The Makefile shows
py3execdir = ${exec_prefix}/lib/python3.3/site-packages
pyexecdir = ${exec_prefix}/lib/python3.3/site-packages
python3dir = ${prefix}/lib/python3.3/site-packages
pythondir = ${prefix}/lib/python3.3/site-packages
推荐答案
如果最终使用了重写宏路线,则可能需要使用变量编写包装宏 AM_PATH_PYTHON2
和 AM_PATH_PYTHON3
,它们只需设置 _AM_PYTHON_INTERPRETER_LIST
并调用> AM_PATH_PYTHON
,带有一个额外的后缀参数.
If you end up going the rewrite-the-macro route, you might want to make use of the variable _AM_PYTHON_INTERPRETER_LIST to write wrapper macros AM_PATH_PYTHON2
and AM_PATH_PYTHON3
that just set _AM_PYTHON_INTERPRETER_LIST
and call AM_PATH_PYTHON
with an extra suffix argument.
这篇关于适用于python2和python3的AM_PATH_PYTHON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!