简体   繁体   中英

How to make Python.h file work in Ubuntu?

I am on an Ubuntu machine and I want to use python in my C code but when I include the Python.h header file, it shows a warning: Python.h: No such file or directory

Any method for this. I have already tried to use:

sudo apt-get install python3-dev and;

sudo apt-get install python-dev

But it keeps showing error.

The Python.h file is not in the default compiler include path.

Add the output of pkg-config --cflags python3 to your compiler command line.

Now the compiler will know where to find Python.h (and any dependencies it may have)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM