掌上百科 - PDAWIKI

 找回密码
 免费注册

QQ登录

只需一步,快速开始

查看: 2193|回复: 3

[求助] 求教大神: PYGLOSSARY 的使用问题

[复制链接]
  • TA的每日心情
    无聊
    2021-1-15 05:13
  • 签到天数: 271 天

    [LV.8]以坛为家I

    发表于 2016-3-28 17:13:48 | 显示全部楼层 |阅读模式
    论坛各位大神:
    ' I: W3 B7 X& `" M! U$ I本人目前在制作瑞-英字典, 正在处理原始数据中, 目的是做出MDict和OSX两个版本的, 所以想要知道OSX字典里具体关于发音的处理, 在OSX字典官方的说明文件和例子中均找不到相关的描述, 所以就想到了看看能不能按照qunwang6的帖子https://www.pdawiki.com/forum/fo ... id=13014&page=1把目前比较完美的MDict词典转为OSX的, 一个是为自己的OSX系统多一个好字典, 第二是可以看到在OSX字典源文件XML里关于是图片和发音的处理, 按照您的帖子, 如果成功的话, 是能够由MDict转出完美的OSX词典的(排版不重要, 可以慢慢调, 关键的东西都在就行)
    7 g1 a" u& J- x7 }. P2 d  T9 ~
    / k# e7 B3 [: R! `/ l& H0 z7 I+ e但目前对于PYGLOSSARY的使用, 碰到了问题, 我的机器是 MacBook Pro, 系统是最新的10.11.4, 已经安装了Xcode, Command Line Tools for Xcode和Auxillary Tools for Xcode, 并执行了
    1. sudo easy_install beautifulsoup4 html5lib
    复制代码
    命令, 但在执行
    1. Python pyglossary.pyw --read-options=resPath=OtherResources --write-format=AppleDict oald8.mdx oald8.xml
    复制代码
    时, 提示
    1. invalid write format AppleDict
    复制代码
    , 甚至在执行
    1. python pyglossary.pyw --help
    复制代码
    都提示一堆错误, 开头是
    1. error while importing plugin appledict
      0 k( @2 _7 U; F( V( u8 I  H5 C0 g
    2. Traceback (most recent call last):+ R6 o- k+ z2 E
    3.   File "/Users/York/Software/pyglossary/pyglossary/glossary.py", line 141, in loadPlugin* L+ k- _2 v6 I
    4.     plugin = __import__(pluginName)
      * y# K+ Z5 T9 E( p
    5.   File "/Users/York/Software/pyglossary/pyglossary/plugins/appledict/__init__.py", line 28, in <module>: h' ?3 S* v% _( ]
    6.     from ._dict import write_xml, get_beautiful_soup% F& Z$ r- |6 ?. B6 E
    7.   File "/Users/York/Software/pyglossary/pyglossary/plugins/appledict/_dict.py", line 26, in <module>
      2 q$ I, z1 K2 |7 O2 f# w
    8.     import xdxf
      1 P) o5 b/ I3 i+ m0 E: t
    9.   File "/Users/York/Software/pyglossary/pyglossary/plugins/xdxf/__init__.py", line 25, in <module>
      / I8 m7 a5 l1 b- ^6 K, t6 @
    10.     from lxml import etree. Y* x  l' N" e4 |! ]% j: M
    11. ImportError: No module named lxml1 k' k! \3 Y; Y+ O
    12. Traceback locals: {'__builtins__': {'ArithmeticError': <type 'exceptions.ArithmeticError'>,2 U; x% V2 c9 Y
    13.                   'AssertionError': <type 'exceptions.AssertionError'>,' R& q0 f0 z% I& B% y( G' m4 o0 X
    14.                   'AttributeError': <type 'exceptions.AttributeError'>,$ W# i/ @5 S: T9 g9 t2 t
    15.                   'BaseException': <type 'exceptions.BaseException'>,
      % K0 h- w, z% m
    16. ---------
    复制代码

    5 B* E& m( e1 U; T2 t1 ~0 Z: @; S, f( p我对python基本一窍不通, 不知道问题出在何处, 不知大神能否指点一二, 先行多谢!

    该用户从未签到

    发表于 2016-3-29 14:21:12 | 显示全部楼层
    : k! f" F6 W# N+ K" z8 g+ Z
    我觉得楼主你貌似环境都没有准备好。
    1 P$ Q& u, e) D4 `8 a/Applications/Utilities/DictionaryDevelopmentKit/ 路径下有没有内容?
    - @' t& `  b" X5 {2 ?: d9 m# Z& L1 G0 H, N
    MAC OSX词典转换笔记 https://www.pdawiki.com/forum/fo ... hread&tid=13014 ' A( @4 f$ |6 y0 b1 @- r2 v& b7 G) r7 i9 M% _
    “【】”内内容为我敲的,其他为 qunwang6 原文。. u6 |& J0 I8 w
    准备好以下环境:. p+ ], E3 X( U2 Q
    【这一步如你所述,已经做了】* BeautifulSoup4 required to sanitize html contents.. $ C3 n3 t- F6 f* i9 D0 S: f
    sudo easy_install beautifulsoup4 html5lib
    - U2 b2 i0 L. t( X/ R# D* c# h4 _9 e" t【这一步不知道你做没做】* GNU make as part of Command Line Tools for Xcode.
    " F! c* B8 O0 W) M0 u6 e; Shttp://developer.apple.com/downloads
    3 I4 K4 V6 O! e0 k【这一步,从你下面操作的错误消息来看,你没有做噢】* Dictionary Development Kit as part of Auxillary Tools for Xcode
    4 V9 S% a( G- Bhttp://developer.apple.com/downloads.
    . h  i: P0 O3 k, W$ f6 E2 P将Dictionary Development Kit解压到/Applications/Utilities/DictionaryDevelopmentKit/7 m- c# H0 S$ z3 S8 @. t
    (不含空格,中文名:应用程序/实用工具那里,也可以解压到其它地方。)

    + ?, }0 t" \. S$ m参考:9 r$ y* ]+ v) X
    http://apple.stackexchange.com/q ... ionary-for-mac-os-x
    , o- q  f, X& Mhttps://github.com/SebastianSzturo/Dictionary-Development-Kit3 T7 Y& G% w" j
    $ V) h9 B3 v6 A/ h9 {6 d; A' H
    另外 lxml 也没装, http://lxml.de/index.html#download; y, _) r" A) c, r& P# l

    ) H+ l3 \' A) f6 |2 ~" D: L. q) g 注:我还没有 Mac 。
    1 Q! Y  l4 K' Z/ U: H  O

    该用户从未签到

    发表于 2016-3-30 13:34:44 | 显示全部楼层
    楼上正解,如果你把Dictionary Development Kit解压到/Applications/Utilities/DictionaryDevelopmentKit/,那么pyglossary.pyw 对应的路径也要改一下,即:python /Applications/Utilities/DictionaryDevelopmentKit/pyglossary/pyglossary.pyw --read-options=resPath=OtherResources --write-format=AppleDict path_oald8.mdx oald8.xml
  • TA的每日心情
    无聊
    2021-1-15 05:13
  • 签到天数: 271 天

    [LV.8]以坛为家I

     楼主| 发表于 2016-4-1 04:57:52 | 显示全部楼层
    多谢二位大神回复, 万分感谢!* i& X5 W6 O7 ]. ]0 H4 b
    正在进一步解决问题中, 如能搞定, 定单独开贴详述具体经过.
    - J4 |0 Q8 [" [- ^再次感谢二位大神指点!
    您需要登录后才可以回帖 登录 | 免费注册

    本版积分规则

    小黑屋|手机版|Archiver|PDAWIKI |网站地图

    GMT+8, 2025-4-28 19:24 , Processed in 0.020941 second(s), 21 queries .

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表