【问题标题】:pyqtdeploy throws an extremely strange issuepyqtdeploy 抛出一个非常奇怪的问题
【发布时间】:2017-09-01 11:03:20
【问题描述】:

我正在使用 pyqtdeploy 将一个非常简单的 python 脚本打包到 Qt 项目中。然后我将尝试将其编译为 .apk 文件。我认为目前环境已经搭建完成,包括Android SDK、Android NDK、Qt、android studio、ant等。运行pyqtdeploy时总是出现奇怪的错误。

这是我的代码:

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_())

截取了一部分错误信息:

..\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);

还有截图:

我的配置:

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

提前致谢!

【问题讨论】:

    标签: android python qt apk pyqt5


    【解决方案1】:

    我远非专家,但在它阅读的文档中,除非目标环境等于源环境,否则检查“运行应用程序”是没有意义的。从您的窗口看来,您正在从 Windows 交叉编译到 Android,因此我会尝试省略“附加构建步骤”(“运行应用程序”)的最后一个参数。然后你必须自己测试它,例如我猜是安卓工作室。希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-26
      • 1970-01-01
      • 2021-08-26
      • 2011-07-12
      • 1970-01-01
      • 2013-02-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多