![](/img/trans.png)
[英]Python - pyinstaller script not working when executing the .exe
[英]Pyinstaller is not executing my Python Script
當我打開我創建的 EXE 文件時,它將打開命令提示符而不運行腳本,它曾經給我一條錯誤消息但我已經完成了--debug-imports
並且它沒有給我錯誤但它仍然沒有' t 運行腳本
單獨在 IDE 中,該腳本工作正常,但當它被制成可執行文件時,它不起作用。
(如果這是重復的,請將我鏈接到已回答的問題)
我還從 IDE (Pycharm) 創建可執行文件
我正在使用 Python 3.9
這是我的腳本:
import pyautogui, time
from pynput.keyboard import Key, Controller
keyboard = Controller()
time.sleep(5)
f = open('beemovie', 'r')
for word in f:
pyautogui.typewrite(word)
pyautogui.press('enter')
您需要在腳本所在的文件夾中打開 powershell/cmd window,方法是單擊 shift+右鍵單擊並選擇打開 powershell 或命令 window,然后在此處編寫命令 for install 'pyinstaller filename 命令。 --onefile filename.py' 或者如果你想隱藏對話框,那么寫'pyinstaller --onefile -w filename.py'。我嘗試了相同的 python 文件,但我認為你應該導入 pyautogui
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.