美文网首页
pyinstaller

pyinstaller

作者: xuxiang | 来源:发表于2017-07-10 11:58 被阅读0次

pyinstaller -w -F --path "d:\Program Files (x86)\python3\Lib\site-packages\PyQt5\Qt\bin" main.py

-w 不用命令行窗口

-F 生成一个单独的文件

有时候打包的后运行会出现:Failed to execute script ***。

有可能是在打包的时候,python程序正在执行过程中,所以打包不完整。退出正在执行的程序,重新打包。

也有可能是执行了os.popen('tasklist')方法引起的,执行这个方式是为了防止多开。

后来发现删掉这段防止多开的代码就行了,所以我就换了一种方法:

if __name__ == "__main__":

ERROR_ALREADY_EXISTS = 183

sz_mutex = "test_mutex"

hmutex = win32event.CreateMutex(None, pywintypes.FALSE,sz_mutex)

if (win32api.GetLastError() == ERROR_ALREADY_EXISTS):

iNo=0

else:

     执行主程序

相关文章

网友评论

      本文标题:pyinstaller

      本文链接:https://www.haomeiwen.com/subject/impyhxtx.html