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.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章