我有一个位于.py中的学校项目,但我希望它及其所有依赖项位于.exe中,它是一个基于GUI的键盘记录器,当我输入
pyinstaller -F pyinstaller -F main.py
时,我得到
pyinstaller -F main.py
448 INFO: PyInstaller: 6.4.0, contrib hooks: 2024.1
449 INFO: Python: 3.12.1
476 INFO: Platform: Windows-11-10.0.22631-SP0
477 INFO: wrote D:\012IP\main.spec
486 INFO: Extending PYTHONPATH with paths
['D:\\012IP']
965 INFO: checking Analysis
965 INFO: Building Analysis because Analysis-00.toc is non existent
965 INFO: Initializing module dependency graph...
967 INFO: Caching module graph hooks...
983 INFO: Analyzing base_library.zip ...
2917 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks'...
4663 INFO: Loading module hook 'hook-pickle.py' from 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks'...
5820 INFO: Loading module hook 'hook-heapq.py' from 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks'...
6269 INFO: Caching module dependency graph...
6452 INFO: Running Analysis Analysis-00.toc
6453 INFO: Looking for Python shared library...
6460 INFO: Using Python shared library: C:\Users\asrar\AppData\Local\Programs\Python\Python312\python312.dll
6460 INFO: Analyzing D:\012IP\main.py
6628 INFO: Loading module hook 'hook-pynput.py' from 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
7209 INFO: Processing pre-safe import module hook six.moves from 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-six.moves.py'.
7522 INFO: Processing module hooks...
7528 INFO: Loading module hook 'hook-_tkinter.py' from 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks'...
7529 INFO: checking Tree
7530 INFO: Building Tree because Tree-00.toc is non existent
7530 INFO: Building Tree Tree-00.toc
7601 INFO: checking Tree
7601 INFO: Building Tree because Tree-01.toc is non existent
7601 INFO: Building Tree Tree-01.toc
7610 INFO: checking Tree
7610 INFO: Building Tree because Tree-02.toc is non existent
7611 INFO: Building Tree Tree-02.toc
7624 INFO: Performing binary vs. data reclassification (925 entries)
7806 INFO: Looking for ctypes DLLs
7825 INFO: Analyzing run-time hooks ...
7827 INFO: Including run-time hook 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py'
7830 INFO: Including run-time hook 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth__tkinter.py'
7860 INFO: Looking for dynamic libraries
8086 INFO: Extra DLL search directories (AddDllDirectory): []
8086 INFO: Extra DLL search directories (PATH): []
8270 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8271 WARNING: Library not found: could not resolve 'api-ms-win-crt-filesystem-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8271 WARNING: Library not found: could not resolve 'api-ms-win-crt-locale-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8272 WARNING: Library not found: could not resolve 'api-ms-win-core-path-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8272 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8273 WARNING: Library not found: could not resolve 'api-ms-win-crt-conio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8273 WARNING: Library not found: could not resolve 'api-ms-win-crt-math-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8274 WARNING: Library not found: could not resolve 'api-ms-win-crt-convert-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8274 WARNING: Library not found: could not resolve 'api-ms-win-crt-time-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8275 WARNING: Library not found: could not resolve 'api-ms-win-crt-process-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8275 WARNING: Library not found: could not resolve 'api-ms-win-crt-environment-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8276 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8276 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8277 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8277 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8277 WARNING: Library not found: could not resolve 'api-ms-win-crt-convert-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8278 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8278 WARNING: Library not found: could not resolve 'api-ms-win-crt-locale-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8279 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8279 WARNING: Library not found: could not resolve 'api-ms-win-crt-math-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8280 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_hashlib.pyd'.
8280 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_hashlib.pyd'.
8281 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_lzma.pyd'.
8281 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_lzma.pyd'.
8281 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_bz2.pyd'.
8282 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_bz2.pyd'.
8282 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_bz2.pyd'.
8283 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\unicodedata.pyd'.
8283 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\unicodedata.pyd'.
8284 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\unicodedata.pyd'.
8284 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\select.pyd'.
8285 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_socket.pyd'.
8285 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_socket.pyd'.
8286 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_socket.pyd'.
8287 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_ctypes.pyd'.
8287 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_ctypes.pyd'.
8288 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_ctypes.pyd'.
8288 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_queue.pyd'.
8289 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_tkinter.pyd'.
8289 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_tkinter.pyd'.
8289 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_tkinter.pyd'.
8289 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll'.
8290 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll'.
8290 WARNING: Library not found: could not resolve 'api-ms-win-crt-convert-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll'.
8290 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll'.
8292 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll'.
8292 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8292 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8292 WARNING: Library not found: could not resolve 'api-ms-win-crt-environment-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8293 WARNING: Library not found: could not resolve 'api-ms-win-crt-filesystem-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8293 WARNING: Library not found: could not resolve 'api-ms-win-crt-convert-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8293 WARNING: Library not found: could not resolve 'api-ms-win-crt-time-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8295 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8295 WARNING: Library not found: could not resolve 'api-ms-win-crt-utility-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8295 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8295 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libffi-8.dll'.
8296 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tcl86t.dll'.
8296 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tcl86t.dll'.
8296 WARNING: Library not found: could not resolve 'api-ms-win-crt-environment-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tcl86t.dll'.
8297 WARNING: Library not found: could not resolve 'api-ms-win-crt-convert-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tcl86t.dll'.
8297 WARNING: Library not found: could not resolve 'api-ms-win-crt-time-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tcl86t.dll'.
8298 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tcl86t.dll'.
8298 WARNING: Library not found: could not resolve 'api-ms-win-crt-utility-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tcl86t.dll'.
8298 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tcl86t.dll'.
8299 WARNING: Library not found: could not resolve 'api-ms-win-crt-math-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tcl86t.dll'.
8299 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tk86t.dll'.
8300 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tk86t.dll'.
8300 WARNING: Library not found: could not resolve 'api-ms-win-crt-convert-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tk86t.dll'.
8301 WARNING: Library not found: could not resolve 'api-ms-win-crt-time-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tk86t.dll'.
8301 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tk86t.dll'.
8303 WARNING: Library not found: could not resolve 'api-ms-win-crt-utility-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tk86t.dll'.
8303 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tk86t.dll'.
8304 WARNING: Library not found: could not resolve 'api-ms-win-crt-math-l1-1-0.dll', dependency of 'C:\\Users\\asrar\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\tk86t.dll'.
8386 INFO: Warnings written to D:\012IP\build\main\warn-main.txt
8409 INFO: Graph cross-reference written to D:\012IP\build\main\xref-main.html
8457 INFO: checking PYZ
8457 INFO: Building PYZ because PYZ-00.toc is non existent
8457 INFO: Building PYZ (ZlibArchive) D:\012IP\build\main\PYZ-00.pyz
8844 INFO: Building PYZ (ZlibArchive) D:\012IP\build\main\PYZ-00.pyz completed successfully.
8874 INFO: checking PKG
8875 INFO: Building PKG because PKG-00.toc is non existent
8875 INFO: Building PKG (CArchive) main.pkg
11823 INFO: Building PKG (CArchive) main.pkg completed successfully.
11846 INFO: Bootloader C:\Users\asrar\AppData\Local\Programs\Python\Python312\Lib\site-packages\PyInstaller\bootloader\Windows-64bit-intel\run.exe
11847 INFO: checking EXE
11847 INFO: Building EXE because EXE-00.toc is non existent
11847 INFO: Building EXE from EXE-00.toc
11848 INFO: Copying bootloader EXE to D:\012IP\dist\main.exe
11924 INFO: Copying icon to EXE
11995 INFO: Copying 0 resources to EXE
11996 INFO: Embedding manifest in EXE
12067 INFO: Appending PKG archive to EXE
12078 INFO: Fixing EXE headers
16119 INFO: Building EXE from EXE-00.toc completed successfully.
我该如何解决这个问题
以下是main.py的内容
import logging
import os
import subprocess
import threading
import webbrowser
from pathlib import Path
from tkinter import *
from pynput.keyboard import Key, Listener
# Determine the base directory of the script
BASE_DIR = Path(__file__).parent
def on_press(key):
logging.info(str(key))
class KeyloggerThread(threading.Thread):
def __init__(self):
super(KeyloggerThread, self).__init__()
self._stop_event = threading.Event()
def run(self):
logging.basicConfig(filename=BASE_DIR / "keyboarddata.txt", level=logging.DEBUG, format='%(asctime)s: %(message)s')
with Listener(on_press=on_press) as listener:
listener.join()
def stop(self):
self._stop_event.set()
def start_keylogger_thread():
global keylogger_thread
keylogger_thread = KeyloggerThread()
keylogger_thread.start()
button_4.config(state="disabled") # Disable start button after starting
def stop_keylogger():
keylogger_thread.stop()
button_4.config(state="normal") # Enable start button after stopping
window.withdraw() # Hide the tkinter window
# Check if the window should be shown again or if the program should exit
def check_window_state():
if not keylogger_thread.is_alive(): # If keylogger thread has stopped
window.destroy() # Destroy the tkinter window
else:
window.after(1000, check_window_state) # Check again after 1 second
window.after(1000, check_window_state) # Start checking window state
def open_keyboard_data():
subprocess.run(["notepad.exe", str(BASE_DIR / "keyboarddata.txt")])
def kill_keylogger():
os._exit(0)
def check_agreement():
agreement_text = entry_1.get()
if "i agree" in agreement_text.lower():
button_2.config(state="normal")
button_3.config(state="normal")
button_4.config(state="normal")
button_5.config(state="normal")
button_6.config(state="normal")
else:
button_2.config(state="disabled")
button_3.config(state="disabled")
button_4.config(state="disabled")
button_5.config(state="disabled")
button_6.config(state="disabled")
def open_youtube_link():
webbrowser.open("https://youtu.be/zGiNGnX5dYg?si=kd02XcV0kysm1lZj&t=32")
window = Tk()
window.title('Keylogger')
# Load background image using relative path
bg_image = PhotoImage(file=str(BASE_DIR / "assets" / "frame0" / "bg.png"))
bg_width = bg_image.width()
bg_height = bg_image.height()
window.geometry(f"{bg_width}x{bg_height}")
window.configure(bg="#000000")
bg_canvas = Canvas(window, bg="#000000", height=bg_height, width=bg_width, bd=0, highlightthickness=0, relief="ridge")
bg_canvas.place(x=0, y=0)
bg_canvas.create_image(0, 0, anchor="nw", image=bg_image)
entry_image_1 = PhotoImage(file=str(BASE_DIR / "assets" / "frame0" / "entry_1.png"))
entry_bg_1 = bg_canvas.create_image(135.5, 324.0, image=entry_image_1)
entry_1 = Entry(bg_canvas, bd=0, bg="#DAE6F4", fg="#000716", highlightthickness=0)
entry_1.place(x=65.0, y=308.0, width=141.0, height=30.0)
button_image_1 = PhotoImage(file=str(BASE_DIR / "assets" / "frame0" / "button_1.png"))
button_1 = Button(bg_canvas, image=button_image_1, borderwidth=0, highlightthickness=0, command=check_agreement, relief="flat")
button_1.place(x=65.0, y=350.0, width=93.88436889648438, height=32.0)
button_image_2 = PhotoImage(file=str(BASE_DIR / "assets" / "frame0" / "button_2.png"))
button_2 = Button(bg_canvas, image=button_image_2, borderwidth=0, highlightthickness=0, command=stop_keylogger, relief="flat", state="disabled")
button_2.place(x=672.0, y=280.0, width=91.0, height=44.0)
button_image_3 = PhotoImage(file=str(BASE_DIR / "assets" / "frame0" / "button_3.png"))
button_3 = Button(bg_canvas, image=button_image_3, borderwidth=0, highlightthickness=0, command=open_youtube_link, relief="flat", state="disabled")
button_3.place(x=493.0, y=230.0, width=318.0, height=30.0)
button_image_4 = PhotoImage(file=str(BASE_DIR / "assets" / "frame0" / "button_4.png"))
button_4 = Button(bg_canvas, image=button_image_4, borderwidth=0, highlightthickness=0, command=start_keylogger_thread, relief="flat", state="disabled")
button_4.place(x=535.0, y=280.0, width=91.0, height=44.0)
button_image_5 = PhotoImage(file=str(BASE_DIR / "assets" / "frame0" / "button_5.png"))
button_5 = Button(bg_canvas, image=button_image_5, borderwidth=0, highlightthickness=0, command=open_keyboard_data, relief="flat", state="disabled")
button_5.place(x=553.0, y=333.0, width=197.0, height=44.0)
button_image_6 = PhotoImage(file=str(BASE_DIR / "assets" / "frame0" / "button_6.png"))
button_6 = Button(bg_canvas, image=button_image_6, borderwidth=0, highlightthickness=0, command=kill_keylogger, relief="flat", state="disabled")
button_6.place(x=593.0, y=400.0, width=120.0, height=30.0)
window.resizable(False, False)
window.mainloop()
您使用的是最新版本的 pyinstaller 吗?在 CMD 中执行
pip install --upgrade pyinstaller
然后重试