command 'x86_64-linux-gnu-gcc' failed with exit status 1

I had the same problem. This one helped me:

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

If you are using python3, try to replace python-dev with python3-dev


Install lib32ncurses5-dev:

sudo apt-get install lib32ncurses5-dev

In a newly created python 3.6, virtual environment and trying to run my setup.py of my module, the following command solved the error,

sudo apt-get install python3.6-dev

For me the error was,

... 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

The remaining packages build-essential libssl-dev libffi-dev there were already installed from a previous time.