LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   ./configure error: what's wrong with these lines? (https://www.linuxquestions.org/questions/programming-9/configure-error-whats-wrong-with-these-lines-4175572458/)

mdooligan 02-17-2016 03:00 AM

./configure error: what's wrong with these lines?
 
Here's the error messages:
Code:

checking for Python include path...  File "<string>", line 1
    import distutils.sysconfig;                                    print distutils.sysconfig.get_python_inc();
                                                                                ^
SyntaxError: invalid syntax

checking Python linker flags...  File "<string>", line 1
    from distutils.sysconfig import *;                      from string import join;                      print join(get_config_vars('VERSION'))
                                                                                                                    ^
SyntaxError: invalid syntax
  File "<string>", line 1
    from distutils.sysconfig import *;                                    from string import join;                                    print '-L' + PREFIX + '/lib',                                    '-lpython';
                                                                                                                                              ^
SyntaxError: invalid syntax

and these are the corresponding lines from configure:
Code:

  # Check for Python include path
  # if PYTHON_INCLUDES is set, do not do anything
  echo "\$PYTHON=$PYTHON"
  if test $python_found = yes; then
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5
$as_echo_n "checking for Python include path... " >&6; }

      if test -z "$PYTHON_INCLUDES"; then
          python_path=`$PYTHON -c "import distutils.sysconfig; \
                                  print distutils.sysconfig.get_python_inc();"`
          if test -n "${python_path}"; then
              python_path="-I$python_path"
          fi
          PYTHON_INCLUDES=$python_path
      fi

      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_INCLUDES" >&5
$as_echo "$PYTHON_INCLUDES" >&6; }

  fi

  # Check for Python linker flags
  # if PYTHON_LIBS is set, do not do anything
  if test $python_found = yes; then
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python linker flags" >&5
$as_echo_n "checking Python linker flags... " >&6; }

      if test "x$PYTHON_LIBS" = "x"; then
          # (makes two attempts to ensure we've got a version number
          # from the interpreter)
          py_version=`$PYTHON -c "from distutils.sysconfig import *; \
                      from string import join; \
                      print join(get_config_vars('VERSION'))"`
          if test "x$py_version" = "xNone"; then
              if test "x$PYTHON_VERSION" != "x"; then
                  py_version=$PYTHON_VERSION
              else
                  py_version=`$PYTHON -c "import sys; \
                              print sys.version[:3]"`
              fi
          fi

          PYTHON_LIBS=`$PYTHON -c "from distutils.sysconfig import *; \
                                  from string import join; \
                                  print '-L' + PREFIX + '/lib', \
                                  '-lpython';"`$py_version
      fi

      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_LIBS" >&5
$as_echo "$PYTHON_LIBS" >&6; }

  fi

I know python is finicky about whitespace so I twiddled with that, but it did nothing. This is from a proper package tarball too.

gnashley 02-17-2016 03:09 AM

It may be an issue with the python version you have vs. whatever was used by the authors.

NevemTeve 02-17-2016 07:09 AM

If you're lucky, you will find an option like --without-python or similar.

mdooligan 02-18-2016 03:03 AM

Quote:

Originally Posted by NevemTeve (Post 5501568)
If you're lucky, you will find an option like --without-python or similar.

Indeed. That's what I did: with-python=no.

Python2.7 vs 3.x I guess. They changed something syntactically? *shakes head* The way python parses -c commands? I have 2.7 and 3.something. I couldn't get it to use either one.

OK. Thank you very much. I'll move along...

ntubski 02-18-2016 08:57 AM

Quote:

Originally Posted by mdooligan (Post 5502106)
Python2.7 vs 3.x I guess. They changed something syntactically?

Yes, specifically the print statement is changed in 3.x to a function call.

Print Is A Function

NevemTeve 02-18-2016 09:41 AM

(If python3 had an other name (boa, for example) people wouldn't think that python and python3^W boa are compatible.)


All times are GMT -5. The time now is 04:58 PM.