1.安装有道辞典
在以下官方网站下载deb包进行安装
http://cidian.youdao.com/multi.html#linuxAll
2.安装成功后在laucher中点击,发现无法打开
3.尝试在命令行打开,出现以下错误信息,并google之
yasin@DTT:/usr/share/youdao-dict$
yasin@DTT:/usr/share/youdao-dict$ youdao-dict
Traceback (most recent call last):
File "/usr/bin/youdao-dict", line 27, in <module>
from dae.daeclient import DAEClient
File "/usr/share/youdao-dict/dae/daeclient.py", line 36, in <module>
from dae.window import Window
File "/usr/share/youdao-dict/dae/window.py", line 30, in <module>
from dae.shadowwindow import ShadowWindow
File "/usr/share/youdao-dict/dae/shadowwindow.py", line 28, in <module>
import dae.xutils as xutils
File "/usr/share/youdao-dict/dae/xutils.py", line 25, in <module>
ewmh = EWMH()
File "/usr/share/youdao-dict/dae/ewmh.py", line 50, in __init__
self.display = _display or display.Display()
File "/usr/lib/python3/dist-packages/Xlib/display.py", line 80, in __init__
self.display = _BaseDisplay(display)
File "/usr/lib/python3/dist-packages/Xlib/display.py", line 62, in __init__
display.Display.__init__(*(self, ) + args, **keys)
File "/usr/lib/python3/dist-packages/Xlib/protocol/display.py", line 129, in __init__
raise error.DisplayConnectionError(self.display_name, r.reason)
Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'No protocol specified\n'
yasin@DTT:/usr/share/youdao-dict$
yasin@DTT:/usr/share/youdao-dict$
4.参考以下链接,了解到上述错误原因和临时解决方案
https://github.com/LiuLang/python3-xlib/issues/6
https://github.com/LiuLang/kwplayer
https://wiki.archlinux.org/index.php/Xhost
https://en.wikipedia.org/wiki/X_Window_authorization
5.按照以上方案尝试,有道辞典可正常打开,log如下
yasin@DTT:/usr/share/youdao-dict$
yasin@DTT:/usr/share/youdao-dict$ xhost +
access control disabled, clients can connect from any host
yasin@DTT:/usr/share/youdao-dict$
yasin@DTT:/usr/share/youdao-dict$
yasin@DTT:/usr/share/youdao-dict$ youdao-dict
<class 'Xlib.protocol.request.QueryExtension'>
Youdao Dict Unique Service is started...
ATTENTION: default value of option bo_reuse overridden by environment.
6.关闭有道辞典后执行以下命令,重新开启host-based access
yasin@DTT:/usr/share/youdao-dict$ xhost -
access control enabled, only authorized clients can connect