AdolfVonKleist / Phonetisaurus

Phonetisaurus G2P
BSD 3-Clause "New" or "Revised" License
449 stars 122 forks source link

configure detects wrong python version #78

Open Valentin-D-Richard opened 1 year ago

Valentin-D-Richard commented 1 year ago

System information

Type Version/Name
Distribution Name Ubuntu
Version 22.04.1 LTS

Describe the problem you're observing

I have python version 3.10.6 and binaries /usr/bin/python3 and usr/bin/python3.10 exist, but not /usr/bin/python3.1.

./configure detects python version 3.1 and stops because it cannot find python3.1 in the system path.

I followed the README tutorial and chose to compile with python3 binding. Here's the last lines of the output of command PYTHON=python3 ./configure --enable-python

checking for python3 version... 3.1
checking for python3 platform... linux
checking for python3 script directory... ${prefix}/local/lib/python3.10/dist-packages
checking for python3 extension module directory... ${exec_prefix}/local/lib/python3.10/dist-packages
checking for python3.1... no
configure: error: Cannot find python3.1 in your system path
proycon commented 1 year ago

I'm also running into this bug now.. It seems the autoconf detection can't deal with minor versions running into the double digits..

Valentin-D-Richard commented 1 year ago

I managed to solve this problem.

It comes from line 12659 of configure. It runs a small python command which simply takes the 3 first characters of the python version. So I changed line 12659 from

  am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`

to

  am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write('.'.join(sys.version.split('.')[:2]))"`

It takes the major and the minor versions of python (exactly, if the version is u.v.w (...), it takes u.v).