首页 > 解决方案 > 基于 Python 的 exe 在 CMD 处抛出错误(pynput 模块)

问题描述

所以这是它在cmd windows 10中抛出的错误。似乎与pynput有关?不太确定我能做些什么来解决这个问题并感谢任何帮助。

C:\Users\Michael\Desktop\herprogram\dist\beeb>beeb.exe
Traceback (most recent call last):
  File "C:\Users\Michael\Desktop\herprogram\beeb.py", line 5, in <module>
    import pynput
  File "c:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pynput\__init__.py", line 40, in <module>
  File "c:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pynput\keyboard\__init__.py", line 31, in <module>
  File "pynput\_util\__init__.py", line 76, in backend
ImportError
[11880] Failed to execute script beeb

非常感谢

标签: pythonpyinstallerpynput

解决方案


我切换到了 pyinstaller 正式支持并使用的不同模块 pywinauto:

import pywinauto
pywinauto.mouse.double_click(button='left', coords=(0, 0))

这解决了这个问题。多谢你们


推荐阅读