掌上百科 - PDAWIKI

 找回密码
 免费注册

QQ登录

只需一步,快速开始

查看: 670|回复: 17

[求助] pyglossary安装使用问题求助

[复制链接]
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

    发表于 2023-3-14 04:29:25 | 显示全部楼层 |阅读模式
    本帖最后由 米莉亚 于 2023-3-14 04:48 编辑
    ! d$ r+ L4 _8 t* l& F- b, @! F. L
    9 d/ L$ W+ A0 X$ v最近看了很多教程然后花了好久好不容易安装成功了,可是使用的过程中却出了问题,折腾了好久还是不能解决。。。- _# B" t: ]; T! j* \' [
    % p# P: Z: L8 I; ]" ^; l5 R

    6 d( E0 }+ U. w! z/ V提示代码如下:; T$ X4 O4 ]- t* d- c( d8 _
    4 J1 K: h; V  g
    [CRITICAL] Traceback (most recent call last):
    9 ]- M. q" l8 y$ |7 U$ J  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_gtk.py", line 996, in onClick+ H) h$ x- u8 ?7 L4 j
        self.dialog = GeneralOptionsDialog(self.ui)
    * `7 o+ K3 A' x/ Z/ [( v2 ~                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- @. l0 j6 b" g% v% N
      File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_gtk.py", line 956, in __init__9 g% s# i/ A! C7 h8 |
        self.updateWidgets()
    , l, A- K% P/ x" c+ @" ~1 I  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_gtk.py", line 968, in updateWidgets
    , `2 H* Z/ h, k% n" F    self.sortOptionsBox.updateWidgets()
    , V; b$ h6 N% A% [  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_gtk.py", line 867, in updateWidgets
    ( c, j# E0 S2 g; N2 O& f    self.localeHBox.set_sensitive(sort)
    - d0 ^! }& T% s    ^^^^^^^^^^^^^^^
    $ Y# {; V/ h( [/ uAttributeError: 'SortOptionsBox' object has no attribute 'localeHBox') i3 X& |: d2 k6 p# e
    0 W. e: O. Z$ \9 b1 [0 _
    - O4 e  W6 [' r+ X
    ' L9 N  r$ n$ G+ k4 B
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2023-3-14 04:44:08 | 显示全部楼层
    Mac版本。真的是折腾到吐血了。。。
  • TA的每日心情

    2023-3-29 00:54
  • 签到天数: 344 天

    [LV.8]以坛为家I

    发表于 2023-3-14 11:08:00 | 显示全部楼层
    pyglossary 不要用gtk界面,用命令行。
    . m! n' ^% [! R* a6 L& h2 F! [" S3 {2 n) n) P! e  z
    $python3 main.py --ui=cmd
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2023-3-14 12:01:53 | 显示全部楼层
    mtaa 发表于 2023-3-14 11:08% e) K/ c8 g/ l+ t" @& o- O6 s
    pyglossary 不要用gtk界面,用命令行。
    $ ^' I/ u5 F8 N# h2 C& k; ]. S5 |% }: e  l; r1 q, I* v1 h
    $python3 main.py --ui=cmd

    2 |0 [- }2 }5 l7 [; h  Ppython3 main.py --ui=cmd3 {  R3 j2 K/ ^/ O5 V
    /usr/local/bin/python3: can't open file '/Users/lemon/main.py': [Errno 2] No such file or directory
    : }/ |$ d+ o9 a3 e- qlemon@lemondeMacBook-Pro ~ % python3 main.py --ui=cmd4 X6 R6 L2 r- B: U5 k
    /usr/local/bin/python3: can't open file '/Users/lemon/main.py': [Errno 2] No such file or directory
  • TA的每日心情

    2023-3-29 00:54
  • 签到天数: 344 天

    [LV.8]以坛为家I

    发表于 2023-3-14 12:42:09 | 显示全部楼层
    先安装:3 o$ ?/ c+ ]7 n; e
    $python3 -m pip install pyglossary
    5 s$ f9 v9 g6 a$ D' W, _& L
    / n0 {+ |+ N, A, V) d安装成功,会显示:successfully installed
    ; t: y- P5 S9 o; m# V* u! |0 f. [
    - @6 Q9 W6 w4 y, ^+ `7 b最后用命令行调用:3 X8 s8 ]1 j+ n4 L

    7 d3 N4 H1 i! Y* a- a$pyglossary --ui=cmd
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2023-3-14 12:50:48 | 显示全部楼层
    mtaa 发表于 2023-3-14 12:42
    # m( b0 T, a5 b, d' n; V先安装:" v( I7 s5 s) i- h$ X& Y
    $python3 -m pip install pyglossary

    * i* {. B' l( ?1 F python3 -m pip install pyglossary
    , r. `8 g! n7 B: Y& P/ pRequirement already satisfied: pyglossary in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (4.6.1)
    3 |8 s& T5 |( X( ?2 alemon@lemondeMacBook-Pro ~ % $pyglossary --ui=cmd* T9 W' a' d& H# H
    zsh: command not found: --ui=cmd
    " K/ k9 A( U0 u3 S
  • TA的每日心情

    2023-3-29 00:54
  • 签到天数: 344 天

    [LV.8]以坛为家I

    发表于 2023-3-14 13:10:39 | 显示全部楼层
    $ 这个前缀表示这是一条命令行,直接运行:
    ' j. M+ Q2 t4 S6 O7 w1 N: X, |/ J* H1 X: q6 s- Y& w
    pyglossary --ui=cmd
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2023-3-14 13:27:46 | 显示全部楼层
    mtaa 发表于 2023-3-14 13:10
    5 @! ?4 Q5 Y  k0 k3 L$ l$ 这个前缀表示这是一条命令行,直接运行:
    1 o, O' l" c; U0 P$ P
    ; v, f$ B; T# N  _7 g9 Tpyglossary --ui=cmd

    / t( Z9 a' H" |( m! upip3 install pyglossary
    6 E+ c4 E: c, x& z/ o1 l7 \Requirement already satisfied: pyglossary in /usr/local/lib/python3.11/site-packages (4.6.1)
    0 ?! B5 e, J8 h, E% alemon@lemondeMacBook-Pro ~ % pyglossary --ui=cmd: V5 n$ w# z# t1 s
    [CRITICAL] Traceback (most recent call last):
    8 s% n0 A, a# T+ v  File "/usr/local/bin/pyglossary", line 8, in <module>
    ( ^' l) ?# m* m5 N/ u    sys.exit(main()): E" i: {# n6 W1 U$ ~, \0 O; d
                 ^^^^^^- F+ Z! n" ~2 [4 i) c2 c2 N7 \
      File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/main.py", line 813, in main
      [: |5 U8 ?8 U3 |$ ^    run = getRunner(args, ui_type)
    & R# m2 D; L/ f          ^^^^^^^^^^^^^^^^^^^^^^^^" o$ w2 O! b& {* T% ~' {+ t
      File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/main.py", line 285, in getRunner* d6 c" d2 N' Q+ b  v
        from pyglossary.ui.ui_cmd_interactive import UI
    8 T! Z) l1 x- s$ I( K  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_cmd_interactive.py", line 62, in <module>. v4 _3 C2 G! }1 f- `% |# ?+ ~
        import prompt_toolkit9 Y: q$ ^1 x6 J
    ModuleNotFoundError: No module named 'prompt_toolkit'
  • TA的每日心情

    2023-3-29 00:54
  • 签到天数: 344 天

    [LV.8]以坛为家I

    发表于 2023-3-14 13:45:54 | 显示全部楼层
    先装这个:
    / W6 `4 M1 i+ n* f; R( z: o0 `python3 -m pip install prompt_toolkit( R6 W- e* e" B

    % S2 L8 A. L6 o之后运行:2 a: a2 L; g2 i0 y
    pyglossary --ui=cmd
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2023-3-14 14:26:03 | 显示全部楼层
    mtaa 发表于 2023-3-14 13:45
    / J2 g& J" d  y- L先装这个:
    / |4 L! g6 d. y2 _3 n) f5 y$ {+ y( {python3 -m pip install prompt_toolkit
    % L9 b/ e' z+ V
    python3 -m pip install prompt_toolkit( H3 e5 r3 q! b2 B; }* w9 B
    Collecting prompt_toolkit4 _0 j* n# c/ q8 J2 m" {
      Downloading prompt_toolkit-3.0.38-py3-none-any.whl (385 kB)
    7 y  l) A. p& Z: @' d     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 385.8/385.8 kB 714.2 kB/s eta 0:00:00
    ( U( P$ L7 [5 Z- u2 {0 @5 Q2 DCollecting wcwidth
    - I- L1 O/ W* b1 C  Downloading wcwidth-0.2.6-py2.py3-none-any.whl (29 kB)( `* w2 |4 Z; T, m  J' s, ]
    Installing collected packages: wcwidth, prompt_toolkit
    ( r0 c# P' K( \* p: zSuccessfully installed prompt_toolkit-3.0.38 wcwidth-0.2.6
    2 ?" I8 X; d  j' Plemon@lemondeMacBook-Pro ~ % pyglossary --ui=cmd
    * |; ~5 Q6 Z/ h& G; ~! B[CRITICAL] Traceback (most recent call last):
    + f# v9 ~5 @/ S  File "/usr/local/bin/pyglossary", line 8, in <module>
    0 g1 {- q) Y% d, e" g    sys.exit(main())
    6 y) W+ q9 p7 g  L             ^^^^^^
    9 D# z5 N8 K- o% D% ^! M  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/main.py", line 813, in main
    5 |: O, g% ]9 z    run = getRunner(args, ui_type)" _% U. ]. J7 y; a3 ?
              ^^^^^^^^^^^^^^^^^^^^^^^^$ ]5 C7 P) N. F$ o$ t
      File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/main.py", line 285, in getRunner! P" w. t3 j* a  P! z: E; n6 O
        from pyglossary.ui.ui_cmd_interactive import UI
    1 B# ]9 n8 u0 t2 q+ W: p- V+ R  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_cmd_interactive.py", line 62, in <module>
    7 `7 O* Y3 P8 `* x4 |    import prompt_toolkit
    , c" `  Y  _$ J6 E, I7 ~ModuleNotFoundError: No module named 'prompt_toolkit'
  • TA的每日心情

    2023-3-29 00:54
  • 签到天数: 344 天

    [LV.8]以坛为家I

    发表于 2023-3-14 14:36:50 | 显示全部楼层
    你系统里python的环境混乱了。
    $ B& g+ {0 p# Q: f& a再装一次:
    # `/ }# g8 H, n6 V6 V
    ; s* Z! x" A3 Gpip3 install prompt_toolkit
    7 B0 r- P8 L8 `: C+ P% k0 @' g, d0 m% d
    之后运行:
      K2 q! e0 v  p' s* C8 d  U' |6 Q4 R( M& k+ @& m9 l4 f7 D
    pyglossary --ui=cmd
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2023-3-14 15:19:52 | 显示全部楼层
    mtaa 发表于 2023-3-14 14:36
    ( h4 u& S; g! b3 B2 L你系统里python的环境混乱了。
    4 R/ F7 H, L. Q' Y" _$ w2 H& T再装一次:

    - S# C- w9 N$ g) e* A1 x> Input file: /Downloads/d.mdx
    0 F' Z' V3 T! z3 s> Output file: /Downloads/d  \7 G. P% Z, A% Y" N. X; c2 i# U
    > Output format: txt
    1 Y! }' o8 T( l. z[ERROR] internal error: invalid format name/desc 'txt'
    $ Z; y" u: |  L: U/ @8 n4 Z0 ~> Output format:7 [+ C* j) P! E% {  b
  • TA的每日心情

    2023-3-29 00:54
  • 签到天数: 344 天

    [LV.8]以坛为家I

    发表于 2023-3-14 15:30:29 | 显示全部楼层
    直接运行:
    % q: |  X/ d, p# h5 ^6 w4 Y* L7 z7 [3 s5 S: q
    pyglossary ~/Downloads/d.mdx ~/Downloads/d.txt --read-format=OctopusMdict --write-format=Tabfile
    * B9 e$ O, {7 h& o: z
    # Q9 Y" L3 {6 q1 X会生成d.txt在下载目录里
  • TA的每日心情

    2023-3-29 00:54
  • 签到天数: 344 天

    [LV.8]以坛为家I

    发表于 2023-3-14 15:33:28 | 显示全部楼层
    如果只是解压mdx/mdd的话,可以安装mdict-utils,更通用。
    8 D; ]- [( J+ s/ ]
    1 h* h! b+ I' `先安装:
    8 m+ F$ E7 [9 npip3 install mdict-utils. V+ s4 d* }1 S

    ' d1 k, }* V4 ?3 X使用:8 U( E" g/ J: v/ z/ x$ H. t7 V
    mdict -x ~/Downloads/d.mdx
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2023-3-14 15:46:19 | 显示全部楼层
    mtaa 发表于 2023-3-14 15:30
    8 N7 {- s' Q: y7 @6 t直接运行:+ y, @; Z+ |, C& l
    ! c& G$ O+ L* s( X% [; K
    pyglossary ~/Downloads/d.mdx ~/Downloads/d.txt --read-format=OctopusMdict --write-format ...

    + D% F4 k5 }1 F* e5 O里面全是代码,我想要的是纯文字内容。
    , r7 i$ X$ B/ W1 E( W, M这是转换好的:
    9 U9 C: A# J0 F. F$        <link href="LEX_style.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="OELD_config.ini"></script> <script type="text/javascript" src="OELD_jquery.js"></script> <script type="text/javascript" src="OELD_script.js"></script> <div class="OELDBody"><div class="entryWrapper world"><div class="entryHead primary_homograph" id="$"><div class="entryTable"><div class="entryWord first"><h1>Definition of <em>$</em> in English:</h1> <h2 class="hwg"><span class="hw" >$</span></h2><div class="hwg"><div class="entryGroup" id="h70342344502560"><h3 class="pronunciations"></h3></div></div></div><div class="entryLogo"><div class="container"> </div></div></div></div><section class="gramb"><h3 class="ps pos"><span class="pos"></span></h3><span class="transitivity"></span><ul class="semb"><li><div class="trg"><p><span class="iteration"></span><span class="ind">Dollar or dollars.</span></p><span class="indicators"></span></div></li></ul></section><section
  • TA的每日心情

    2023-3-29 00:54
  • 签到天数: 344 天

    [LV.8]以坛为家I

    发表于 2023-3-14 16:13:31 | 显示全部楼层
    本帖最后由 mtaa 于 2023-3-14 16:19 编辑 / a; ~! P3 E$ z. q4 }

    ! m. H. E( [, H9 T. I+ F% n用这个:. N( c8 T$ K6 O2 @5 Y
    pyglossary ~/Downloads/d.mdx ~/Downloads/d.txt --read-format=OctopusMdict --write-format=Tabfile --remove-html-all
    3 y2 @) N0 s4 c7 V6 a
    ! C- y5 o4 z5 T% i, m* W6 t没有处理的HTML标签,用文本编辑器打开,替换掉就可以。
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2023-3-14 16:39:04 | 显示全部楼层
    mtaa 发表于 2023-3-14 16:13, Y. E- B0 L6 P. N% d
    用这个:
    % ~2 R; T: J9 A, \  X- x9 dpyglossary ~/Downloads/d.mdx ~/Downloads/d.txt --read-format=OctopusMdict --write-format=Ta ...
    8 G) b$ ]( s- s5 f: k
    好的,非常感谢!!!昨天就到了导出文本全是代码的那步,查解决方法于是出现了调g t k界面接着出现了这个帖子的问题。。。
  • TA的每日心情
    奋斗
    2020-6-15 09:00
  • 签到天数: 34 天

    [LV.5]常住居民I

    发表于 2023-12-5 15:30:09 | 显示全部楼层
    参考这个看看有没有帮助:https://bookfere.com/post/883.html#pg_76d8_windows
    您需要登录后才可以回帖 登录 | 免费注册

    本版积分规则

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

    GMT+8, 2024-3-28 18:40 , Processed in 0.035006 second(s), 8 queries , MemCache On.

    Powered by Discuz! X3.4

    Copyright © 2001-2023, Tencent Cloud.

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