Python 3.6 on Ubuntu 16.04 and derivatives

Came across the following answer on askubuntu, explaining how to get Python 3.6 on Ubuntu 16.04:

Which involves basically these steps:
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6

However, for compiling packages through pip, you also need to install the header files:
sudo apt-get install python3.6-dev