Python.h file not found on Ubuntu 20.04 even after installing python-dev

Ask Ubuntu Asked by hhg on January 3, 2022

I just switched to Linux (Ubuntu 20.04) from Windows. After installing python-dev I notice that Python.h is still not included, which breaks my integrated Python-C++ build (I’m using pybind11). I also tried to install every other variant of python-dev I saw mentioned online (python3-dev, python-devel, etc.) but to no avail.

Interestingly, installing python3-dev on Ubuntu 18.04 includes this file and everything works.

Might this be a bug in the 20.04 version?

2 Answers

Try installing the package libpython3.8-dev, that should put the Python.h file into /usr/include/python3.8/Python.h
Use apt-file search Python.h to find the packages that contain it. After installing apt-file, you will need to run apt-fil update to let it update its database.

Answered by ubfan1 on January 3, 2022

You can try the following:

sudo updatedb
locate Python.h



Then set

export CPATH=/usr/include/python3.5m:$CPATH

Answered by turbulence on January 3, 2022

Add your own answers!

Related Questions

How to give a 64-bit windows app at least 4gb with Wine?

0  Asked on December 6, 2020 by lelorrain


Secondary partition -I cant Execute files

0  Asked on December 5, 2020 by martin-andersen


can’t execute a script via the startmenu in Gnome

0  Asked on December 5, 2020 by vrms


Uneven refresh rate on display

0  Asked on December 5, 2020 by curiousstudent


Cursor stuck in select mode

1  Asked on December 5, 2020 by mohand-andel


Where’s the Flatpak on Ubuntu 20.04?

2  Asked on December 4, 2020 by user1079583


How to install trello in ubuntu

3  Asked on December 3, 2020 by ujjal-das


Bluetooth not working hp pavillion g6

0  Asked on December 3, 2020 by fastonkill


Convert Ubuntu Physical machine to Virtual machine

3  Asked on December 3, 2020 by cyberquarks


Music Production Tools (DJ)

1  Asked on December 2, 2020 by user244589


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP