2017-09-01 107 views
1

我正在使用pyqtdeploy將一個非常簡單的python腳本打包到Qt項目中。然後我會嘗試將它編譯爲.apk文件。我認爲到目前爲止環境已經完全建立,包括Android SDK,Android NDK,Qt,android studio,ant等。運行pyqtdeploy時總會出現一個奇怪的錯誤。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); 

和截圖:

enter image description here

我的配置:

enter image description here

有沒有人遇到過類似的問題?我應該做些什麼?

在此先感謝!

回答

0

我遠不是專家,但在它讀取的文檔中,檢查「運行應用程序」是沒有意義的,除非目標環境與源環境相同。從你的Windows看來,你正在交叉編譯從Windows到Android,因此我會嘗試省略「其他構建步驟」(「運行應用程序」)的最後一個參數。然後你必須從例如你自己來測試它。 Android工作室我猜。希望能幫助到你。