./autogen.sh: configure: error: Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.

can anyone please help?

checking for python version... 2.7  
checking for python platform... linux2  
checking for python script directory... ${prefix}/lib/python2.7/dist-packages  
checking for python extension module directory... ${exec_prefix}/lib/python2.7/dist-packages  
checking which Python to use for Pyuno... 
checking for a Python interpreter with version >= 3.3... python3  
checking for python3... /usr/bin/python3  
checking for python3 version... 3.4  
checking for python3 platform... linux  
checking for python3 script directory... ${prefix}/lib/python3.4/site-packages  
checking for python3 extension module directory... ${exec_prefix}/lib/python3.4/site-packages
system  
checking Python.h usability... no  
checking Python.h presence... no  
checking for Python.h... no  
configure: error: Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS   environment variables.  
Error running configure at ./autogen.sh line 266.  
      
ThinkPad-T410:~/opensource/office/core$ env | grep python
PYTHON_CLIBS=/usr/include/python3.4/  
PYTHON_LIBS=/usr/include/python3.4  
PYTHON_CFLAGS=/usr/include/python3.4/  

ThinkPad-T410:~/opensource/office/core$ ls /usr/include/python3.4/Python.h   
/usr/include/python3.4/Python.h

first problem looks like: checking Python.h usability… no – It’s a long shot-> maybe check the file permissions in the include dir?

More directly you could try (from $>./autogen.sh --help)

–enable-python= ONE OF: no/auto/system/internal/fully-internal

                      Enables or disables Python support at run-time and
                      build-time. Also specifies what Python to use.
                      'auto' is the default. 'fully-internal' even forces
                      the internal version for uses of Python during the
                      build.

I would try autogen with --enable-python=internal

And if that fails try =fully-internal

As you figure out the flags that you need, add them to /core/autogen.input file.

I suggest you ask your future build questions on the dev list – http://lists.freedesktop.org/mailman/listinfo/libreoffice

All that said, unless you have been setting this option to ‘system’, the ‘auto’ default should have fallen back to internal. Poking around in /core, I have seen what appears to be an internal Python 3.3… Looks like you are encountering an issue with the configure script, but I think =internal will help get you further along.

I fixed this by installing the libpython3-dev package.

(Note, I already had the libpython-dev installed.)


Before installing this package:

sudo find / -name Python.h
/usr/include/python2.7/Python.h

After installing this package:

sudo find / -name Python.h
/usr/include/python2.7/Python.h
/usr/include/python3.5m/Python.h