【发布时间】:2021-07-14 19:04:22
【问题描述】:
我在 c++ 应用程序中使用 pybind11 解释器。不幸的是,由于遗留原因,我不使用 CMake 构建,而是使用 qmake。因此,我很难理解如何正确设置 pybind11 解释器。 c++ 应用程序将附带捆绑的 python 3.7(因此在 Mac 上,应用程序捆绑包将附带 python.framework)
解释器应该使用捆绑的 python (MyApp.app/Contents/Frameworks/Python.framework/Versions/Current/Python),但是在打印 sys.exec_prefix 时,它总是回退到它发现安装的任何东西,所以在我的例子中:/Library/Frameworks/Python.framework/Versions/3.9/Python
我的 .pro 设置如下所示:
QMAKE_LFLAGS += -F/$$PWD/../3rdParty/python
LIBS += -framework Python
INCLUDEPATH += $$PWD/../3rdParty/python/Python.framework/Versions/3.7/include/python3.7m
DEPENDPATH += $$PWD/../3rdParty/python/Python.framework/Versions/3.7/include/python3.7m
如何告诉 pybind11 / 我的可执行文件使用什么 python 可执行文件和环境?不应强制目标用户安装 python 来运行我的应用程序
【问题讨论】: