我如何在 QMake 中包含 python.h

how can i include python.h in QMake

INCLUDEPATH = -L /usr/include/python2.7

LIBS += /usr/local/lib/python2.7

QMAKE_CXXFLAGS += /usr/local/lib/python2.7

error: cannot find /usr/local/lib/python2.7: File format not recognized

有问题。 我已经安装了 python-all-dev.

您必须使用以下格式:

LIBS += -L {path of your library.so} -l{library}    
INCLUDEPATH += {path of your headers} 
DEPENDPATH += {path of your headers} 

你的情况:

LIBS += -L /usr/local/lib/python2.7 -lpython2.7

INCLUDEPATH += /usr/include/python2.7
DEPENDPATH += /usr/include/python2.7