ubuntu 16.10 如何安装ldtp

很简单

sudo apt-get update
sudo apt-get install ldtp

验证ldtp
在python命令行

>>> import ldtp
>>> from ldtp import *
>>> guiexist('-gedit')
0

但是报错:

/usr/local/lib/python2.7/dist-packages/ldtpd/core.py:29: PyGIWarning: Wnck was imported without specifying a version first. Use gi.require_version('Wnck', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Wnck as wnck

解决方法:
那就到/usr/local/lib/python2.7/dist-packages/ldtpd/core.py代码的29行改一下,在第二十九行之前加一句代码

  import gi
  gi.require_version('Wnck', '3.0')

结果,代码如下图所示

try:
  # If we have gtk3+ gobject introspection, use that
  import gi
  gi.require_version('Wnck', '3.0')
  from gi.repository import Wnck as wnck
  from gi.repository import Gtk as gtk
  from gi.repository import Gdk as gdk
  wnckModule=gtk3=True
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值