Python.h missing in Blender Python? I'm compiling an external C package for my Blender  2.78a Python 3.5.

My compiling script looks like

from distutils.core import setup, Extension
import numpy
setup(name='_tifffile', ext_modules=[Extension('_tifffile', ['tifffile.c'], include_dirs=[n
umpy.get_include()])])


Upon running it, I got

tifffile.c:71:20: fatal error: Python.h: No such file or directory
 #include "Python.h"
                    ^
compilation terminated.
error: command 'gcc' failed with exit status 1


I looked into /blender-2.78a-linux-glibc211-x86_64/2.78/python/include/python3.5m/ and indeed didn't see Python.h. 

In general Python community, people suggest simply uninstalling the current Python and reinstalling the dev version. I don't wanna hack the Python bundled with Blender like that.

How can I solve this problem?
First, if you install blender with your linux distro,
then a proper installation of python3 and blender with your particular distro should solve your problem.   

e.g. for debian:


sudo apt-get install python3 python3-dev 
sudo apt-get install blender


Second, if you really want to install the python header files
for the python that runs inside blender, then you can do it the following way:

Find out the exact blender python version:


/path/to/blender-2.78a-linux-glibc211-x86_64/2.78/python/bin/python3.5m -V


Download and install the python header files from the official python homepage:


point your browser at https://www.python.org/downloads/source/
download Gzipped source tarball from the exact same python version as your blender python version
cd ~/Downloads/
tar -xzf Python-3.X.X.tgz
cp Python-3.X.X/Include/* /path/to/blender-2.78a-linux-glibc211-x86_64/2.78/python/include/python3.5m/


That should get you rolling. 
Best, Bue