TransWikia.com

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

Output:

/usr/include/python2.7/Python.h
/usr/include/python3.5m/Python.h

Then set

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

Answered by turbulence on January 3, 2022

Add your own answers!

Ask a Question

Get help from others!

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