Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
基于Python的exe在CMD处抛出错误(pynput模块)_Python_Pyinstaller_Pynput - Fatal编程技术网

基于Python的exe在CMD处抛出错误(pynput模块)

基于Python的exe在CMD处抛出错误(pynput模块),python,pyinstaller,pynput,Python,Pyinstaller,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>

这就是它在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
C:\Users\Michael\Desktop\herprogram\dist\beeb>beeb.exe
回溯(最近一次呼叫最后一次):
文件“C:\Users\Michael\Desktop\herprogram\beeb.py”,第5行,在
导入pynput
exec_模块中的文件“c:\python38\lib\site packages\PyInstaller\loader\pyimod03_importers.py”,第493行
exec(字节码、模块、指令)
文件“pynput\\uuuu init\uuuuu.py”,第40行,在
exec_模块中的文件“c:\python38\lib\site packages\PyInstaller\loader\pyimod03_importers.py”,第493行
exec(字节码、模块、指令)
文件“pynput\keyboard\\uuuuu init\uuuuuuu.py”,第31行,在
文件“pynput\\u util\\uuuu init\uuuuuu.py”,第76行,在后端
强求恐怖
[11880]无法执行脚本beeb

非常感谢

我切换到另一个pywinauto模块,该模块由pyinstaller正式支持并使用:

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

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

尝试使用pynput的1.6.8版,如果它有您需要的功能,pynput==1.6.8这个命令是通过cmd与pyinstaller一起使用的吗?感谢您使用哪个命令创建应用程序?我刚刚在PowerShell中运行了pyinstaller file.exe好的,请尝试运行
pyinstaller--hidden import=pynput==1.6.8;file.py