Take the 2-minute tour ×

I want to embedded python code in Qt C++ code. I create a console Qt app for test.

My .pro is

SOURCES += main.cpp
LIBS = -lboost_python -lpython27

HEADERS += /usr/include/python2.7

My main.cpp file is

#include <QCoreApplication>
#include <boost/python.hpp>

using namespace boost::python;

int main(int argc, char *argv[])
    QCoreApplication a(argc, argv);

    return a.exec();

But I found I can't build this program.

error message is:

Error:pyconfig.h: No such file or directory

I googled this problem, but havn't got answer.

How to configure Qt I want embedded Python code in My Qt C++ program?

share|improve this question
Do you have the python developer package installed on your system? Generally, package maintainers only distribute pyconfig.h in the developer package. –  Tanner Sansbury Mar 9 '13 at 4:23
I can find pyconfig.h in /usr/include/python2.7 I had install libpython2.7 in Ubuntu –  midCat Mar 9 '13 at 4:50

1 Answer 1

it's INCLUDEPATH, not HEADERS in .pro file.

share|improve this answer

Your Answer


