簡體   English   中英

創建Onefile應用時如何修復Pyinstaller Mac OS錯誤

[英]How to fix Pyinstaller Mac Os error when creating onefile app

您好,我嘗試在Mac OS 10.13中使用pyinstaller,但收到該錯誤:

teloss-Mac:client telos$ pyinstaller --onefile gui.py 
94 INFO: PyInstaller: 3.4
94 INFO: Python: 2.7.15
114 INFO: Platform: Darwin-17.7.0-x86_64-i386-64bit
116 INFO: wrote /Users/telos/Desktop/Telos-Monitor-Tool/client/gui.spec
134 INFO: UPX is not available.
137 INFO: Extending PYTHONPATH with paths
['/Users/telos/Desktop/Telos-Monitor-Tool/client',
 '/Users/telos/Desktop/Telos-Monitor-Tool/client']
137 INFO: checking Analysis
138 INFO: Building Analysis because Analysis-00.toc is non existent
138 INFO: Initializing module dependency graph...
141 INFO: Initializing module graph hooks...
258 INFO: running Analysis Analysis-00.toc
273 INFO: Caching module hooks...
280 INFO: Analyzing /Users/telos/Desktop/Telos-Monitor-Tool/client/gui.py

Syntax error in /Users/telos/Desktop/Telos-Monitor-Tool/client/gui.py
  File "/Users/telos/Desktop/Telos-Monitor-Tool/client/gui.py", line 98
     msg.exec()
            ^
 SyntaxError: invalid syntax

最奇怪的是,在linux和Windows上,腳本運行正常,並且該gui.py中沒有語法錯誤

如果在Mac OS中,我使用python gui.py腳本可以正常工作,但是如果使用python啟動器,則會收到發送錯誤的部分相同錯誤代碼:

    @staticmethod
    def _donation_messages(self):
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Information)
        msg.setWindowTitle("")
        msg.setWindowIcon(QIcon('img\icon.ico'))
        msg.setText("")
        msg.setTextInteractionFlags(Qt.TextSelectableByKeyboard|Qt.TextSelectableByMouse)
        msg.exec()

尋求幫助

添加@eyllanesc寫的幫助很好,需要將msg.exec()更改為msg.exec_()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM