I encountered this error whiling install the PyPy port of Numpy on Ubuntu 16.04. Here is how to solve it.
The command line I used was:
$ pip install git+https://bitbucket.org/pypy/numpy.git
The error message was like this:
1 2 3
# a bunch of tracebacks # then this line SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
The solution is actually to install the pypy-dev package instead of the python-dev package suggested by the error message.
$ sudo apt-get intall pypy-dev $ pip install git+https://bitbucket.org/pypy/numpy.git
Thanks to http://askubuntu.com/a/612016/219398.