简体   繁体   中英

Autotools - Use Python 2.7 when Python 3 is available

I use Arch Linux. python --version returns Python 3.6.2, python2 --version (and python2.7 --version ) returns Python 2.7.13. Automake searches for a python newer than 2.4 and finds python (3.6). The project doesn't work with python 3, though. AM_PATH_PYTHON(<min-version>[,...]) doesn't allow one to specify a maximum version.

How can I have automake search for python2 if python is too new? Or is there a better way to deal with this problem? Automake should still find python if it's the correct version because this build needs to be able to run on distributions that have older packages (for instance, Ubuntu 14.04).

PYTHONAM_PATH_PYTHON设置为一个宝贵的变量 ,你可以在配置时覆盖它的选择:

$ PYTHON=python2 ./configure

Until it's fixed upstream, I would do something like:

mkdir ~/autotools_bin/
ln -s /usr/bin/python2 ~/autotools_bin/python
export PATH="~/autotools_bin:$PATH"

Then it can only find python2 (named python) and your system isn't messed up, only processes you run with the changed PATH.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM