AppDividend
Latest Code Tutorials

How to Solve Python h no such file or directory

0

Python h no such file or directory is a fatal error. If you are trying to build a shared library using a C extension file, you need to install the development version of Python. If you are using Python 3, then you need to install the python3-dev.

Python h no such file or directory

To solve Python.h: No such file or directory error; you need to install the correct development version of Python. If you haven’t correctly installed the header files, and static libraries for python-dev, use one of the following commands as per your operating system.

For Ubuntu

sudo apt-get install python-dev   # for python2.x installs
sudo apt-get install python3-dev  # for python3.x installs

For Python 3.7 and Ubuntu, in particular, you need the following version.

sudo apt install libpython3.7-dev

For Python 3.6, type the following command.

sudo apt install libpython3.6-dev

For Python 3.8, type the following command.

sudo apt install libpython3.8-dev

For Python 3.9, type the following command.

sudo apt install libpython3.9-dev

For CentOS, RHE

sudo yum install python-devel    # for python2.x installs
sudo yum install python3-devel   # for python3.x installs

For Fedora

sudo dnf install python2-devel  # for python2.x installs
sudo dnf install python3-devel  # for python3.x installs

If you want to use a version of Python that is not linked to python3, install the associated python3.x-dev package.

sudo apt-get install python3.5-dev

That is it for resolving Python h no such file error.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.