简体   繁体   中英

Pyinstaller is not executing my Python Script

When I open my created EXE file it will open the command prompt and not run the script, it use to give me an error message but I have done --debug-imports and it doesn't give me the error but it still doesn't run the script

Alone in the IDE, the script works fine but when it is made into an Executable it doesn't work.

(If this is a Duplicate please link me to the answered problem)

I am also creating the executable from an IDE (Pycharm)

I am using Python 3.9

This is my Script:

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')

You need to open powershell/cmd window in folder in which the script is by clicking shift+right click and selecting open powershell or command window here then write command 'pyinstaller filename.py' for files and for one.exe file write command 'pyinstaller --onefile filename.py' or if you want to hide the dialogue box coming so write 'pyinstaller --onefile -w filename.py'.i tried same python file but I think you should Import pyautogui

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM