简体   繁体   English

Pyinstaller 没有执行我的 Python 脚本

[英]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当我打开我创建的 EXE 文件时,它将打开命令提示符而不运行脚本,它曾经给我一条错误消息但我已经完成了--debug-imports并且它没有给我错误但它仍然没有' t 运行脚本

Alone in the IDE, the script works fine but when it is made into an Executable it doesn't work.单独在 IDE 中,该脚本工作正常,但当它被制成可执行文件时,它不起作用。

(If this is a Duplicate please link me to the answered problem) (如果这是重复的,请将我链接到已回答的问题)

I am also creating the executable from an IDE (Pycharm)我还从 IDE (Pycharm) 创建可执行文件

I am using Python 3.9我正在使用 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您需要在脚本所在的文件夹中打开 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.

相关问题 Python - 执行 .exe 时 pyinstaller 脚本不起作用 - Python - pyinstaller script not working when executing the .exe 通过pyinstaller在C#上执行python脚本的问题 - Problem of executing python script on C# through pyinstaller 执行使用 Pyinstaller 构建的 Python 应用程序会出现“无法执行脚本主程序” - Executing Python application built with Pyinstaller gives “Failed to execute script main” pyinstaller 在执行我的 python 应用程序后无法导入模块 - pyinstaller failed to import a module after executing my python application 系统服务未执行我的Python脚本 - Systemd service not executing my Python script Crontab 没有在我的 Mac 上执行 Python 脚本? - Crontab not executing a Python script on my Mac? 执行我用 pyinstaller 制作的 .exe 时出错 - Error while executing my .exe made with pyinstaller python脚本中的Pyinstaller用法 - Pyinstaller usage within python script Python - pyinstaller:读取脚本内的路径文件以在 pyinstaller 中使用 - Python - pyinstaller : Read path file inside script to use in pyinstaller 我使用pyinstaller创建了python可执行文件,但是执行可执行文件时不存在导入到.py脚本的模块 - I created a python executable by using pyinstaller, but the module imported to my .py script is not present when I execute executable
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM