I find /usr/bin/env
isn't a perfect, granular Python detector. However, I just found it is possible to limit AM_PATH_PYTHON
to major version 2.
Look through your aclocal.m4 file for the variable "_AM_PYTHON_INTERPRETER_LIST". In my Mac environment, the list of Python binaries looks like this:
m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl
python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
If you trim the list by issuing this call immediately before AM_PATH_PYTHON, you can limit the checked-for Python binaries. So, this effectively limits you to python2.6+:
m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python2 python2.7 python2.6])
AM_PATH_PYTHON(2.6)