[Python] ModuleNotFoundError with "keyboard" when using Pyinstaller

Discussão em 'Python' iniciado por Stack, Maio 1, 2025.

  1. Stack

    Stack Membro Participativo

    My python program runs successfully, but I encounter the following error message when I try to open the executable(created using pyinstaller). I tested it with a simple example and faced the same issue.

    Traceback (most recent call last):
    File "test.py", line 1, in <module>
    ModuleNotFoundError: No module named 'keyboard'
    [23788] Failed to execute script 'test' due to unhandled exception!


    Here is a simple code i used:

    import keyboard

    print("press Q to quit")
    keyboard.wait('Q')

    Continue reading...

Compartilhe esta Página