fatal error Python h No such file or directory

0 votes

I am trying to build a shared library using a C extension file but first I have to generate the output file using the command below:

gcc -Wall utilsmodule.c -o Utilc

After executing the command, I get this error message:

> utilsmodule.c:1:20: fatal error: Python.h: No such file or directory
compilation terminated.

I have tried all the suggested solutions over the internet but the problem still exists. I have no problem with Python.h. I managed to locate the file on my machine.

Nov 27, 2020 in Python by anonymous
• 8,880 points

1 answer to this question.

0 votes

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
answered Nov 27, 2020 by Gitika
• 65,870 points

Related Questions In Python

0 votes
1 answer

Error executing Jupyter command 'notebook': [Errno 2] No such file or directory

Hi@akhtar, I think there is a problem with ...READ MORE

answered Jun 25, 2020 in Python by MD
• 95,140 points
0 votes
1 answer

/usr/bin/env: ‘python’: No such file or directory

Hi@akhtar, It seems your python script is not ...READ MORE

answered Sep 20, 2020 in Python by MD
• 95,140 points
+2 votes
6 answers

How can I change directory or "cd" in Python?

Context Manager: cd import os class cd:     """Context manager for ...READ MORE

answered Oct 18, 2018 in Python by Nabarupa
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,983 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
0 votes
2 answers
0 votes
1 answer

Python Error: ModuleNotFoundError: No module named '<moduleName>'

Python3 and pip are most likely pointing ...READ MORE

answered Nov 22, 2020 in Python by Gitika
• 65,870 points