C++ throws fatal error: python.h: no such file or directory when it is not able to find python header file. This could be due to bad installation of static libraries and Python dev header files.
Solution with Code Example
To resolve this error, use your package manager to install the correct version of python-dev package system wide. Use these commands –
sudo apt-get install libpython3.6-dev
Here 3.6 is the version of python running in the system. Replace it with the one, you are running.