蟒蛇 -->pyinstaller - .exe 文件将返回“测试返回 -1"; [英] python --> pyinstaller - .exe file will return "test returned -1"
问题描述
[1]代码是:
import Tkinter
from Tkinter import *
# Create Tk instance
root = Tkinter.Tk(className="test")
# Open Notepad
def openNotepad():
import pywinauto
app = pywinauto.Application.start("notepad.exe")
# Add menu
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label="01 File", menu=filemenu)
filemenu.add_command(label="New", command=openNotepad)
# Pack all
root.mainloop()
[2]如果我双击 .py 文件,代码就可以工作.
[2] The code works if I double click on .py file.
如果我只保留 openNotepad() 函数,那么 .exe 将起作用.
If I leave only the openNotepad() function, then .exe will work.
根据文档:https://github.com/pyinstaller/pyinstaller/wiki/Supported-Packages,支持pywinauto库.
According to docs: https://github.com/pyinstaller/pyinstaller/wiki/Supported-Packages, the pywinauto library is supported.
如果我只留下 Tkinter 代码段,.exe 将起作用.
If I leave only the Tkinter snippet, the .exe will work.
因此,请分享我做错了什么,或者请为 python 2.7x 推荐其他 python 安装程序.
Therefore please share what I am doing wrong or please suggest other python installer for python 2.7x.
推荐答案
通过注释掉以下开头的行:excludedimports in files \PyInstaller\hooks\hook-PIL.py 和 hook-PIL.SpiderImagePlugin.py,问题是解决了.
By commenting out the line starting with: excludedimports in files \PyInstaller\hooks\hook-PIL.py and hook-PIL.SpiderImagePlugin.py, the problem was solved.
这篇关于蟒蛇 -->pyinstaller - .exe 文件将返回“测试返回 -1";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!