当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - Include <Python.h> to makefile.am

问题描述:

I apologize for this newbie question. I am currently looking to embedded a small python code into a main C code. It has been suggested to use #include <Python.h> at the header. I have already done so and that my Ubuntu12-0.4 machine also has python-dev installed.

By running locate Python.h, I got /usr/include/python2.7/Python.h.

However, when I include Python.h into my C program, it still gives me fatal error: python.h: No such file or directory.

So Python.h hasn't been include in the Makefile. But I have no idea how to do so. Looking into my package list I have: Makefile.am,Makefile.in, and Makefile.


In Makefile.am:

ACLOCAL_AMFLAGS = -I m4

EXTRA_DIST = MIGRATION README.rst libmodbus.spec

SUBDIRS = src doc tests

pkgconfigdir = $(libdir)/pkgconfig

pkgconfig_DATA = libmodbus.pc

In Makefile.in,

the first line says

# Makefile.in generated by automake 1.14.1 from Makefile.am.

Should I also include the complete description of Makefile.in to here? I am not sure how should I proceed.

网友答案:

I've got the same error, try this:

gcc -I/usr/include/python2.7 yoursource.c -o yourprogram

This solution is from: Can't find Python.h file on CentOS

分享给朋友:
您可能感兴趣的文章:
随机阅读: