#include <Python.h>#include "mainwindow.h"#include <QApplication>#include <QDebug>int main(int argc, char *argv[]){Py_SetPythonHome(L"C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\\");Py_Initialize();if(!Py_IsInitialized()){return -1;}PyObject* pModule = PyImport_ImportModule("hi");if(!pModule){qDebug() <<"open failure";return -1;}PyObject* pFunhello = PyObject_GetAttrString(pModule,"hello");if(!pFunhello){qDebug() <<"get function hello failed";return -1;}PyObject_CallFunction(pFunhello, NULL);Py_Finalize();QApplication a(argc, argv);MainWindow w;w.show();return a.exec();}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。