close

[Solved] fatal error: Python.h: No such file or directory

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error fatal error: Python.h: No such file or directory in Python. So Here I am Explain to you all the possible solutions here.

Without Wasting your time, Lets start This Article to Solve This Error.

How To Solve fatal error: Python.h: No such file or directory?

Question: How To Solve fatal error: Python.h: No such file or directory?
Answer: To Solve fatal error: Python.h: No such file or directory Just run Sudo apt-get install python-dev. Maybe you haven’t properly installed the header files and static libraries for python-dev. Use your package manager to install them.

Maybe you haven’t properly installed the header files and static libraries for python-dev. Use your package manager to install them.

Solution 1 : For Ubuntu

Run this command to solve this error.

sudo apt-get install python-dev
sudo apt-get install python3-dev

Solution 2 : For CentOS

Run this command to solve this error.

sudo yum install python-devel    
sudo yum install python3-devel   

Solution 3 : For Cygwin

Run this command to solve this error.

apt-cyg install python-devel
apt-cyg install python3-devel

Solution 4 : For Python 3

If you are running on python 3 then you have to install.

sudo apt-get install python3-dev

Solution 5 : For python3.x-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

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment