24、Ubuntu 模拟按键

Ubuntu 模拟按键

http://stackoverflow.com/questions/5714072/simulate-keystroke-in-linux-with-python
http://stackoverflow.com/questions/2575528/simulating-key-press-event-using-python-for-linux/2576118#2576118
决定试一下 python-uinput 
http://tjjr.fi/sw/python-uinput/

pip install python-uinput,出错:

/usr/bin/ld: cannot find libudev.so.0
collect2: error: ld returned 1 exit status
error: command 'i686-linux-gnu-gcc' failed with exit status 1

google搜:error: command 'i686-linux-gnu-gcc' failed with exit status 1

http://blog.csdn.net/niyingxunzong/article/details/13094875说
sudo apt-get install python-dev
提示已安装,

搜:python /usr/bin/ld: cannot find libudev.so.0
明显应该搜这个才对的。。。。。

http://stackoverflow.com/questions/21934217/relocate-mouse-cursor-on-screen说
sudo apt-get install libudev0:i386
提示:       
现在没有可用的软件包 libudev0,但是它被其它的软件包引用了。
这可能意味着这个缺失的软件包可能已被废弃,
或者只能在其他发布源中找到

怀疑我的源有问题。。。
sudo apt-get install  python-xlib
已安装

https://github.com/atom/atom/issues/1814说

IT WORKS! I'm Ubuntu 13.04.
It did complain about libudev. Apparently I already had it and just needed to symlink to it: sudo ln -sf /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.0.


~$ sudo ln -sf /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.0
ln: 无法创建符号链接"/lib/x86_64-linux-gnu/libudev.so.0": 没有那个文件或目录
还好听说过“符号链接”这种东西,才试过locate:
~$ locate libudev.so.0
~$ locate libudev
/lib/i386-linux-gnu/libudev.so.1
/lib/i386-linux-gnu/libudev.so.1.3.5
。。。。。。。。。。。。
改一下:
~$ sudo ln -sf /lib/i386-linux-gnu/libudev.so.1 /lib/i386-linux-gnu/libudev.so.0
~$  sudo  pip install python-uinput
安装成功。

回头看之前搜到的文章:
https://bbs.archlinux.org/viewtopic.php?id=127320
https://github.com/rogerwang/node-webkit/wiki/The-solution-of-lacking-libudev.so.0
这两篇文章都说到了建立符号链接,但是文章太长,没细看。。。。
第一篇还说:(建立符号链接)Bad idea, it may cause problems with any future updates
Fixing the build process (probably something in the makefile needs to be fixed), submit a bug upstream if there isn't one already.
Manually creating symlinks and/or adding/deleting/moving files from the filesystem is always a bad idea, later on it can result in a borked system or weird problems that no one else is experiencing and therefore can't be of much help in solving the problem.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章