首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >auto-py-to-exe在加载模块钩子' hook -gevent.py‘时卡住

auto-py-to-exe在加载模块钩子' hook -gevent.py‘时卡住
EN

Stack Overflow用户
提问于 2021-04-26 02:25:40
回答 1查看 358关注 0票数 3

我正在尝试使用auto-py- to -exe将代码转换为exe。它停留在“加载模块钩子' hook -gevent.py'...”。

代码语言:javascript
复制
import time, pyautogui, keyboard, threading
from tkinter import *

window = Tk()
window.title('KONG Spammer')
window.resizable(False, False)

def clickedStart():
    time.sleep(2.5)
    for i in range(int(txt2.get())):
        strDelay = txt3.get()
        floatDelay = float(strDelay)
        time.sleep(floatDelay)
        pyautogui.write(txt.get())
        pyautogui.press('enter')


lbl = Label(window, text='Spam message:', font=('segoe script', 18), background='orange', justify=CENTER)
lbl.grid(column=10, row=0, padx=(35, 10))

txt = Entry(window, width=10)
txt.grid(column=10, row=1, padx=(35, 10))
txt.insert(END, 'message')

lbl2 = Label(window, text='Spam amount:', font=('segoe script', 18), background='orange', justify=CENTER)
lbl2.grid(column=10, row=2, padx=(35, 10))

txt2 = Entry(window, width=10)
txt2.grid(column=10, row=3, padx=(35, 10))
txt2.insert(END, 'amount')

lbl3 = Label(window, text='Spam delay:', font=('segoe script', 18), background='orange', justify=CENTER)
lbl3.grid(column=10, row=4, padx=(35, 10))

txt3 = Entry(window, width=10)
txt3.grid(column=10, row=5, padx=(35, 10))
txt3.insert(END, 'delay')

btn = Button(window, text='Start', command=clickedStart, bg='green', fg='white')
btn.grid(column=10, row=6, padx=(35, 10), pady=(15,10))

window.geometry('275x275')
window.configure(bg='orange')

icon = PhotoImage(file = 'appIcon.png')
window.iconphoto(False, icon)

txt.focus()
window.mainloop()

下面是auto-py-to-exe的日志:

代码语言:javascript
复制
Running auto-py-to-exe v2.8.0
Building directory: C:\Users\Floom\AppData\Local\Temp\tmpx8agn6z6
Provided command: pyinstaller --noconfirm --onedir --windowed --icon "F:/Downloads/KONGSpammer.ico" --add-data "F:/Dokumente/code/appIcon.png;."  "F:/Dokumente/code/KONGSpammer.py"
Recursion Limit is set to 5000
Executing: pyinstaller --noconfirm --onedir --windowed --icon F:/Downloads/KONGSpammer.ico --add-data F:/Dokumente/code/appIcon.png;. F:/Dokumente/code/KONGSpammer.py --distpath C:\Users\Floom\AppData\Local\Temp\tmpx8agn6z6\application --workpath C:\Users\Floom\AppData\Local\Temp\tmpx8agn6z6\build --specpath C:\Users\Floom\AppData\Local\Temp\tmpx8agn6z6

33831 INFO: PyInstaller: 4.3
33845 INFO: Python: 3.9.4
33861 INFO: Platform: Windows-10-10.0.19041-SP0
33876 INFO: wrote C:\Users\Floom\AppData\Local\Temp\tmpx8agn6z6\KONGSpammer.spec
33893 INFO: UPX is not available.
33901 INFO: Extending PYTHONPATH with paths
['F:\\Dokumente\\code', 'C:\\Users\\Floom\\AppData\\Local\\Temp\\tmpx8agn6z6']
33914 INFO: checking Analysis
33922 INFO: Building Analysis because Analysis-00.toc is non existent
33938 INFO: Initializing module dependency graph...
33941 INFO: Caching module graph hooks...
33960 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
33973 INFO: Analyzing base_library.zip ...
35566 INFO: Processing pre-find module path hook distutils from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
35583 INFO: distutils: retargeting to non-venv dir 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib'
37487 INFO: Caching module dependency graph...
37608 INFO: running Analysis Analysis-00.toc
37626 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\users\floom\appdata\local\programs\python\python39\python.exe
37679 WARNING: lib not found: api-ms-win-core-path-l1-1-0.dll dependency of c:\users\floom\appdata\local\programs\python\python39\python39.dll
37814 INFO: Analyzing F:\Dokumente\code\KONGSpammer.py
39677 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-urllib3.packages.six.moves.py'.
40780 INFO: Processing pre-find module path hook site from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
40795 INFO: site: retargeting to fake-dir 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\fake-modules'
41583 INFO: Processing pre-safe import module hook setuptools.extern.six.moves from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-setuptools.extern.six.moves.py'.
44164 INFO: Processing module hooks...
44176 INFO: Loading module hook 'hook-certifi.py' from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
44181 INFO: Loading module hook 'hook-cv2.py' from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
44193 INFO: Loading module hook 'hook-eel.py' from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
44276 INFO: Loading module hook 'hook-pycparser.py' from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
44285 INFO: Loading module hook 'hook-win32ctypes.core.py' from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
44428 INFO: Loading module hook 'hook-difflib.py' from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
44433 INFO: Loading module hook 'hook-distutils.py' from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
44435 INFO: Loading module hook 'hook-distutils.util.py' from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
44441 INFO: Loading module hook 'hook-encodings.py' from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
44515 INFO: Loading module hook 'hook-gevent.py' from 'c:\\users\\floom\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...

这里有没有人有同样的问题或者知道该怎么做?ps:一切都应该与代码一起工作,因为当我启动py文件时,它也可以工作。

EN

回答 1

Stack Overflow用户

发布于 2021-07-07 05:32:27

在下面添加简短的答案:

在cmd中完成(假设你在windows上),等待SyntaxError结束,将会有两个,但在一段时间后,它应该会继续并创建可执行文件。如果你找不到保存exe的地方,请阅读输出,它应该在某个地方,或者google,它将它们保存在各自的操作系统上。

编辑:对不起,我认为这是不正确的解决方案,这只是一个巧合,它是有效的,我会努力找到我做了什么来解决它。

我和你有同样的问题,但经过一段时间的尝试之后,我想我有了一个解决方案。

我将导入日志添加到我的python文件中,并在windows cmd中使用pyinstaller而不是auto-py- to -exe。

我使用的命令是:

代码语言:javascript
复制
pyinstaller --noconfirm --onefile --windowed "C:/Users/user/Downloads/file.py"

您可以在auto-py-to-exe中设置设置,并在“当前命令”中复制粘贴命令

编辑2:我有两个相同的python文件,唯一的区别是文件名中有下划线,而另一个没有。文件名中有下划线的文件可以完美地转换为exe,而另一个则不是。

编辑3,解决方案:我只是等待,即使它在命令中给出了一个错误,它仍然工作,也就是使用我原来的建议。如果这不起作用,我做的另一件事是将from tkinter import *更改为import tkinter as tk

这意味着Tk()变成了tk.Tk(),Label变成了tk.Label,依此类推。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67256860

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档