On a fresh Debian image, cloning https://github.com/python/cpython and running:
./configure make sudo make altinstall
Got 3.7 installed and working for me.
Looks like I said I would update this answer with some more explanation and two years later I don’t have much to add.
- this SO post explains why certain libraries like
python-devmight be necessary.
- this SO post explains why one might use the
altinstallas opposed to
installargument in the make command.
Aside from that I guess the choice would be to either read through the cpython codebase looking for
#include directives that need to be met, but what I usually do is keep trying to install the package and just keep reading through the output installing the required packages until it succeeds.
Reminds me of the story of the Engineer, the Manager and the Programmer who’s car rolls down a hill.