简体   繁体   English

在 raspberrypi(ubuntu18.04) 上运行 pynput lib 示例程序

[英]Run pynput lib example program on raspberrypi(ubuntu18.04)

example program: https://pypi.org/project/pynput/ The part called 'Monitoring the mouse '示例程序: https://pypi.org/project/pynput/名为“监控鼠标”的部分

Actually I tried all the examples,but none can run successful实际上我尝试了所有示例,但没有一个可以成功运行

This is report error ↓:这是报错↓:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/home/ubuntu/.local/lib/python2.7/site-packages/pynput/_util/__init__.py", line 193, in run
    self._run()
  File "/home/ubuntu/.local/lib/python2.7/site-packages/pynput/_util/xorg.py", line 385, in _run
    self._context = dm.record_create_context(
  File "/home/ubuntu/.local/lib/python2.7/site-packages/Xlib/display.py", line 227, in __getattr__
    raise AttributeError(attr)
AttributeError: record_create_context

That's because I use VNC to remote control my raspberrypi, when I tried to connect screen, keyboard and mouse to my raspberrypi, it works! Thank you all!那是因为我使用VNC远程控制我的树莓派,当我尝试将屏幕,键盘和鼠标连接到我的树莓派时,它可以工作!谢谢大家!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM