Tuve el mismo problema y esto lo resolvió:
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
Si usas python3, cambia python-dev por python3-dev.
Otras soluciones que funcionan
Instalar lib32ncurses5-dev:
sudo apt-get install lib32ncurses5-dev
En un entorno virtual recién creado con python 3.6, al ejecutar el setup.py de mi módulo, este comando resolvió el error:
sudo apt-get install python3.6-dev
El error era:
... Python.h: No such file or directory
18 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Los paquetes build-essential libssl-dev libffi-dev ya los tenía instalados de antes.