简体   繁体   中英

Cython code : Python.h no such file or directory

when I generate C code from python3 code with cython3 and try to compile with gcc the resulting code, I get this error : test.c:4:20: fatal error: Python.h: Aucun fichier ou dossier de ce type .

I looked over the web for this error, and all the answer were about installing python2-dev or python3-dev , but I already have this two installed in my computer. I don't only have these two, but I have python3.4-dev and python3.5-dev too.

So can anyone give me the solution to this error.

PS : I am using Ubuntu 15.10 with linux version > 4 .

You should compile using the appropriate paths, like this...

$ gcc -o test test.c `pkg-config --cflags --libs python3`

What happened before is that you weren't including the appropiate include paths (retrieved by pkg-config --cflags ) and library/linking paths (retrieved by pkg-config --libs ). Including both, your program should be able to compile and link.

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