【问题标题】:Python based exe throwing error at CMD (pynput module)基于 Python 的 exe 在 CMD 处抛出错误(pynput 模块)
【发布时间】:2021-01-12 17:31:08
【问题描述】:

所以这是它在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

非常感谢

【问题讨论】:

  • 如果pynput 1.6.8版本有你需要的功能,请尝试使用pynput==1.6.8
  • 这个命令是否可以通过 cmd 与 pyinstaller 一起使用?谢谢
  • 您使用哪个命令制作您的应用程序?
  • 我只是在powershell中运行pyinstaller file.exe
  • 好的,尝试运行pyinstaller --hidden-import=pynput==1.6.8; file.py

标签: python pyinstaller pynput


【解决方案1】:

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

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

这解决了这个问题。谢谢大家

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-10-23
    • 2023-02-15
    • 1970-01-01
    • 2014-10-13
    • 2014-05-31
    • 2022-01-16
    • 2017-03-02
    • 2022-09-23
    相关资源
    最近更新 更多