fatal error: Python.h: No such file or directory
Looks like you haven't properly installed the header files and static libraries for python dev. Use your package manager to install them system-wide.
For apt
(Ubuntu, Debian...):
sudo apt-get install python-dev # for python2.x installssudo apt-get install python3-dev # for python3.x installs
For yum
(CentOS, RHEL...):
sudo yum install python-devel # for python2.x installssudo yum install python3-devel # for python3.x installs
For dnf
(Fedora...):
sudo dnf install python2-devel # for python2.x installssudo dnf install python3-devel # for python3.x installs
For zypper
(openSUSE...):
sudo zypper in python-devel # for python2.x installssudo zypper in python3-devel # for python3.x installs
For apk
(Alpine...):
# This is a departure from the normal Alpine naming# scheme, which uses py2- and py3- prefixessudo apk add python2-dev # for python2.x installssudo apk add python3-dev # for python3.x installs
For apt-cyg
(Cygwin...):
apt-cyg install python-devel # for python2.x installsapt-cyg install python3-devel # for python3.x installs
On Ubuntu, I was running Python 3 and I had to install
sudo apt-get install python3-dev
If you want to use a version of Python that is not linked to python3, install the associated python3.x-dev package. For example:
sudo apt-get install python3.5-dev
For Python 3.7 and Ubuntu in particular, I needed
sudo apt install libpython3.7-dev
.I think at some point names were changed from pythonm.n-dev
to this.
for Python 3.6, 3.8, and 3.9 similarly:
sudo apt install libpython3.6-dev
sudo apt install libpython3.8-dev
sudo apt install libpython3.9-dev