pyqtdeploy抛出了一个非常奇怪的问题。

时间:2022-06-26 04:38:36

I am using pyqtdeploy to pack a much simple python script into Qt Project. Then I will try to compile it as .apk file. I consider the environment has been completely set up so far, including Android SDK, Android NDK, Qt, android studio, ant etc. A strange error always appears when running pyqtdeploy.

我使用pyqtdeploy将一个简单的python脚本打包到Qt项目中。然后我会试着把它编译成。apk文件。我认为目前的环境已经完全建立,包括Android SDK, Android NDK, Qt, Android studio, ant等。在运行pyqtdeploy时总会出现一个奇怪的错误。

Here is my code:

这是我的代码:

import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel


class Main(QWidget):

    def __init__(self):
        super().__init__()
        self.build_inter()

    def build_inter(self):
        self.lb = QLabel("Test", self)
        self.lb.move(0, 0)

        self.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = Main()
    sys.exit(app.exec_())

I intercepted a part of error information:

我截取了一部分错误信息:

..\include/pyport.h:617:60: error: expected constructor, destructor, or type conversion before '(' token
 #                       define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
                                                            ^
..\include/fileutils.h:109:1: note: in expansion of macro 'PyAPI_FUNC'
 PyAPI_FUNC(int) _Py_get_inheritable(int fd);
 ^
..\include/pyport.h:617:60: error: expected constructor, destructor, or type conversion before '(' token
 #                       define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
                                                            ^
..\include/fileutils.h:111:1: note: in expansion of macro 'PyAPI_FUNC'
 PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
 ^
..\include/pyport.h:617:60: error: expected constructor, destructor, or type conversion before '(' token
 #                       define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
                                                            ^
..\include/fileutils.h:114:1: note: in expansion of macro 'PyAPI_FUNC'
 PyAPI_FUNC(int) _Py_dup(int fd);

and the screenshot:

截图:

pyqtdeploy抛出了一个非常奇怪的问题。

My config:

我的配置:

pyqtdeploy抛出了一个非常奇怪的问题。

Have anyone encountered a similar problem? What am I supposed to do?

有没有人遇到过类似的问题?我该怎么做?

Thanks in advance!

提前谢谢!

1 个解决方案

#1


0  

I'm far from being an expert, but in the documentation it reads it does not make sense to check "run application" unless the target environment is equal to the source environment. From your windows it seems you are cross compiling from Windows to Android, thus I would try to omit the last parameter of "Additional build steps" ("run application"). You would then have to test it yourself from e.g. Android studio I guess. Hope it helps.

我绝不是专家,但在文档中,检查“运行应用程序”是没有意义的,除非目标环境与源环境相同。从您的windows看来,您是从windows到Android的交叉编译,因此我将尝试省略“额外构建步骤”(“运行应用程序”)的最后一个参数。然后你需要自己测试一下,比如Android studio。希望它可以帮助。

#1


0  

I'm far from being an expert, but in the documentation it reads it does not make sense to check "run application" unless the target environment is equal to the source environment. From your windows it seems you are cross compiling from Windows to Android, thus I would try to omit the last parameter of "Additional build steps" ("run application"). You would then have to test it yourself from e.g. Android studio I guess. Hope it helps.

我绝不是专家,但在文档中,检查“运行应用程序”是没有意义的,除非目标环境与源环境相同。从您的windows看来,您是从windows到Android的交叉编译,因此我将尝试省略“额外构建步骤”(“运行应用程序”)的最后一个参数。然后你需要自己测试一下,比如Android studio。希望它可以帮助。