September 16, 2024

How to mend Fatal mistake : Python.h : no such data file OR directory ?

3 min read
rb_thumb

rbs-img

How to mend Fatal mistake : Python.h : no such data file OR directory ?

Whether apply AN aged linguistic communication the likes of C/C++ OR something more than Modern the like python , you volition have got admittance to 100 , if non chiliad , of library that ’ ll do your life easy .

nonetheless , a convenient A they be , they oft cause mistake that stump developer .

in this article , we ’ re talk about the “ Fatal mistake : Python.h : no such data file OR directory ” issue , information technology cause and what you can make to furbish up the problem .

What cause this mistake ?

The fault be in the main trigger off when your code fail to see the Python.h library .

This can come about because of several reason : header data file and still library for python dev haven ’ t be install .

The included data file mightiness non have got the same default include way of life .

Incorrect import In the code .

as well read : How to bushel Javascript mistake : ipython be non define ?

How to furbish up this fault ?

here be 3 kettle of fish you can essay out .

instal the needed Python-dev library open the depot and apply the undermentioned bidding to instal Python-dev base on your operating system .

# for Debian ( Ubuntu ) sudo apt-get install python-dev build-essential # python2.x sudo apt-get install python3-dev build-essential # python3.x # for Redhat / CentOS sudo yum instal python-devel # python2.x sudo yum install python3-devel # python3.x # for Alpine Linux sudo apk add python2-dev # python2.x sudo apk add python3-dev # python3.x # for openSUSE sudo zypper In python-devel # python2.x sudo zypper In python3-devel # python3.x # for Cygwin apt-cyg install python-devel # for python2.x apt-cyg install python3-devel # for python3.x # for raspberry bush PI sudo apt-get install python3-dev # for python3.x keep IN psyche that just install python3-dev doesn ’ t needfully cover all version of python on your machine .

For example , if you ’ re run python 3.8 on your machine , you mightiness have got to modify the bidding to sudo apt-get install python3.8-dev build-essential .

also read : How to bushel error : That port be already In utilisation ?

Ensure python version compatibility some other thing to check out for be whether OR non the bundle you ’ re use back up the version of python you ’ re running play .

If you ’ re unsure , you can head to the PyPI web site and expression for your bundle , provide you use PyPi to download the bundle in the first spot .

one time at that place , check over the python version require for the bundle .

If run AN elderly version , update your python installing and essay once more .

include the way of life and library Finally , if you ’ ve get the right version of the library and python instal , you can essay include the way of life and library a AN argument in the compile dictation itself .

For python two : -I/usr/include/python2.7 -lpython2.7 For python iii : -I/usr/include/python2.7 -lpython3.7 also read : How to repair Attributeerror : byte object ha No attribute read ?

Source: Candid.Technology

Leave a Reply

Your email address will not be published. Required fields are marked *