您好,我尝试在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()
寻求帮助
答案 0 :(得分:0)
添加@eyllanesc写的帮助很好,需要将msg.exec()
更改为msg.exec_()