我对pyinstaller有问题;我有一个python文件(Main\u w\u PyQt5.py),它使用了三个图片(kepler.png;keplerII.png和kepler.ico)。我将pyinstaller用于以下参数:
pyinstaller --onefile --noconsole --icon='kepler.ico' --add-data='kepler.png;.' --add-data='keplerII.png;.' --clean Main_w_PyQt5.py
exe文件工作得很好,直到我想通过调用exit函数来关闭它时,窗口会弹出“Fail to execute Main\u w\u PyQt5.py”
有什么问题吗
回答my (confirmed) comment:
不要使用} module is optional ),根据文档:
exit
。它仅用于交互式解释器(它是not even guaranteed to exist since the ^{使用
sys.exit
,which is the correct way to signal your intent to exit a script人们变得懒惰并使用
exit
,因为它恰好在大多数简单的脚本环境中工作,但PyInstaller一点也不简单,使用它会给您带来麻烦相关问题 更多 >
编程相关推荐