如何在 QMake 中包含 python.h

how can i include python.h in QMake

本文关键字:包含 python QMake      更新时间:2023-10-16

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