pykeyboard 不从其模块导入

pykeyboard not importing from its module

我遇到无法从其库 pykeyboard 导入包 PyKeyboard 的问题。执行以下操作时: from pykeyboard import PyKeyboard 我遇到以下错误:

  File "relay.py", line 9, in <module>
    from pykeyboard import PyKeyboard
ImportError: cannot import name 'PyKeyboard' from 'pykeyboard' (/home/pi/.local/lib/python3.7/site-packages/pykeyboard/__init__.py)

卸载软件包,运行 从根目录,或重新安装 Python 导致我根本无济于事。我在一堵砖墙上。

确保安装了依赖项。考虑到您正在使用 PyUserInput 0.1.11 ()

Depending on your platform, you will need the following python modules for PyUserInput to function:

  • Linux - Xlib
  • Mac - Quartz, AppKit
  • Windows - pywin32, pyHook

如果您使用 Windows,安装 pywin32 运行

pip install pywin32

而对于pyHook make sure to install your system's version. Here you'll find both 64 and 32. Note that for whl files,可能需要安装轮子,因为

pip install wheel

然后

wheel install file_name.whl

安装依赖项后,安装带有

的包
pip install PyUserInput