Error while installing detectron2 from source

I ran pip install ‘git+https://github.com/facebookresearch/detectron2.git’
but got an error message:

fatal error: ‘Python.h’ file not found
#include <Python.h>
^~~~~~~~~~
1 error generated.
error: command ‘/usr/bin/clang’ failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> detectron2

Could not find what the problem is…