掌上百科 - PDAWIKI

 找回密码
 免费注册

QQ登录

只需一步,快速开始

查看: 1985|回复: 3

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

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

    [LV.8]以坛为家I

    发表于 2016-3-28 17:13:48 | 显示全部楼层 |阅读模式
    论坛各位大神: ; x, I- b8 y1 h+ G- y9 Y
    本人目前在制作瑞-英字典, 正在处理原始数据中, 目的是做出MDict和OSX两个版本的, 所以想要知道OSX字典里具体关于发音的处理, 在OSX字典官方的说明文件和例子中均找不到相关的描述, 所以就想到了看看能不能按照qunwang6的帖子https://www.pdawiki.com/forum/fo ... id=13014&page=1把目前比较完美的MDict词典转为OSX的, 一个是为自己的OSX系统多一个好字典, 第二是可以看到在OSX字典源文件XML里关于是图片和发音的处理, 按照您的帖子, 如果成功的话, 是能够由MDict转出完美的OSX词典的(排版不重要, 可以慢慢调, 关键的东西都在就行)5 H* X& E: p3 R  K7 U$ U9 K1 ~
    ; l7 U% R3 D  @1 k; |' @' r7 }
    但目前对于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: R8 K& z5 N; Y8 ~3 W  r2 f
    2. Traceback (most recent call last):; o( h+ U' c# h& W+ ]( s8 K
    3.   File "/Users/York/Software/pyglossary/pyglossary/glossary.py", line 141, in loadPlugin
      6 g  U  ?+ ]( o4 q7 R
    4.     plugin = __import__(pluginName)
      $ y6 ^# n1 H8 F' b, |
    5.   File "/Users/York/Software/pyglossary/pyglossary/plugins/appledict/__init__.py", line 28, in <module>- y& e7 `% B7 H9 }  z4 {/ |1 _1 M
    6.     from ._dict import write_xml, get_beautiful_soup
      5 B$ o1 r$ S& m$ J  r
    7.   File "/Users/York/Software/pyglossary/pyglossary/plugins/appledict/_dict.py", line 26, in <module>
      7 ^- s0 V& j1 b6 G$ f% T& J" n
    8.     import xdxf
      . ^' q. P$ s, b9 k1 F1 B3 l- o
    9.   File "/Users/York/Software/pyglossary/pyglossary/plugins/xdxf/__init__.py", line 25, in <module>2 p4 q2 x3 O, P4 _' D
    10.     from lxml import etree0 F0 k. O/ y  m- M" \
    11. ImportError: No module named lxml0 u# s) K' t# J  Y
    12. Traceback locals: {'__builtins__': {'ArithmeticError': <type 'exceptions.ArithmeticError'>,
      1 a' [" u& H2 t3 L9 c" c' o
    13.                   'AssertionError': <type 'exceptions.AssertionError'>,
      / b, E2 N# i1 e4 x3 m& _  y) H
    14.                   'AttributeError': <type 'exceptions.AttributeError'>,5 y' v" N' F0 B
    15.                   'BaseException': <type 'exceptions.BaseException'>,
      5 e  H* o6 \" M/ Y, p  j  }
    16. ---------
    复制代码

    3 X- }" \3 j$ H4 C3 P5 D! T$ l2 q' [我对python基本一窍不通, 不知道问题出在何处, 不知大神能否指点一二, 先行多谢!

    该用户从未签到

    发表于 2016-3-29 14:21:12 | 显示全部楼层
    4 f! ~2 s9 e* k3 P
    我觉得楼主你貌似环境都没有准备好。
      s; W/ n* `! R3 v: _! i/Applications/Utilities/DictionaryDevelopmentKit/ 路径下有没有内容?
    - D, M! [' B/ a" V; C' m7 i. N
    9 b0 B7 Z' F! D0 oMAC OSX词典转换笔记 https://www.pdawiki.com/forum/fo ... hread&tid=13014
    2 }7 J7 W+ u9 }2 f8 S: y2 y“【】”内内容为我敲的,其他为 qunwang6 原文。8 s% ?8 `" Y: x% V% c/ p5 w
    准备好以下环境:
    * Y5 f  y- z: `8 t9 P【这一步如你所述,已经做了】* BeautifulSoup4 required to sanitize html contents..
    " i" }" d8 A' [( l& y( l8 F# Rsudo easy_install beautifulsoup4 html5lib0 M' B1 ^3 n* @( {) K
    【这一步不知道你做没做】* GNU make as part of Command Line Tools for Xcode.5 ?/ d, f2 `6 {# C) t
    http://developer.apple.com/downloads6 U+ G# T  z; I9 z! d3 H) l, _
    【这一步,从你下面操作的错误消息来看,你没有做噢】* Dictionary Development Kit as part of Auxillary Tools for Xcode ) K$ [$ v% r' P' x! s
    http://developer.apple.com/downloads.
    0 @+ c& Z# }% f7 f将Dictionary Development Kit解压到/Applications/Utilities/DictionaryDevelopmentKit/
    ( M+ G7 m+ A& L- x, T. P/ n$ a(不含空格,中文名:应用程序/实用工具那里,也可以解压到其它地方。)

    * F+ b+ f8 Q6 t% ^参考:8 P0 v% S# ?# S7 P4 O% U" Q& |( o
    http://apple.stackexchange.com/q ... ionary-for-mac-os-x
    " x$ l) ^; f. P( {3 }1 `% Shttps://github.com/SebastianSzturo/Dictionary-Development-Kit) ?# ^7 d. C% v8 G, \' I

    ; M5 C' b6 R: B# B+ q+ _/ L另外 lxml 也没装, http://lxml.de/index.html#download
    ' g: a9 g) b+ u$ U) X: X8 h) B: H" K# R# s' `4 w
    注:我还没有 Mac 。% k; N9 |5 J0 l# t% E% K% Q( 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 | 显示全部楼层
    多谢二位大神回复, 万分感谢!2 X& M+ S: S. C; ?  i4 c3 d
    正在进一步解决问题中, 如能搞定, 定单独开贴详述具体经过.  Z: T$ ^% {& ]  z+ b, D
    再次感谢二位大神指点!
    您需要登录后才可以回帖 登录 | 免费注册

    本版积分规则

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

    GMT+8, 2024-4-26 05:12 , Processed in 0.040358 second(s), 9 queries , MemCache On.

    Powered by Discuz! X3.4

    Copyright © 2001-2023, Tencent Cloud.

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