掌上百科 - PDAWIKI

 找回密码
 免费注册

QQ登录

只需一步,快速开始

查看: 749|回复: 17

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

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

    [LV.4]偶尔看看III

    发表于 2023-3-14 04:29:25 | 显示全部楼层 |阅读模式
    本帖最后由 米莉亚 于 2023-3-14 04:48 编辑
      A4 \/ v* ?9 E# {0 Y/ B" t
    % J9 G4 }& T' {7 z0 ?* ]最近看了很多教程然后花了好久好不容易安装成功了,可是使用的过程中却出了问题,折腾了好久还是不能解决。。。
    % t4 h- [; a+ X  i, B3 b; s& ]2 B9 w
    4 |4 U( A2 W7 O5 F9 ~; ]2 i' z5 |( |9 L/ p2 r
    提示代码如下:& Z! T- G- ~& j; Y7 Q. ]
    % D" u* f: U( S7 |( q9 R
    [CRITICAL] Traceback (most recent call last):
    $ `+ r0 l( ?: J% b: D  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_gtk.py", line 996, in onClick
    " `  G" l4 P, P# c6 ~6 `7 \- h  p1 @    self.dialog = GeneralOptionsDialog(self.ui)- ?, _. y0 i; Z  n- K$ ?
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ' z) u5 q$ I6 \% p6 B  O  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_gtk.py", line 956, in __init__
    + Y4 B% f& b' M  `- P; x- C    self.updateWidgets()4 m, T; U. S, o/ T: w7 a$ _
      File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_gtk.py", line 968, in updateWidgets* l- [; f. d! Y" a$ ]
        self.sortOptionsBox.updateWidgets()8 P2 s5 J! _# N9 m' l, o
      File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_gtk.py", line 867, in updateWidgets
    4 l. `8 |: r5 }# i- u    self.localeHBox.set_sensitive(sort)/ G1 b- n- }! |$ `/ F1 G
        ^^^^^^^^^^^^^^^& v* s9 }$ Q# a6 c& ^+ g0 H
    AttributeError: 'SortOptionsBox' object has no attribute 'localeHBox'! W) I1 R" b0 y0 ]

    . c+ d8 c6 o- E- [/ @2 F/ _  Z6 {1 g: }) @( G! A0 E  K+ {

    3 l: x; M* p0 A/ K5 i8 i
  • 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界面,用命令行。3 h1 K, q1 U! A; `- ~

    3 d8 u% c* j6 W5 V2 h$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
    / K. F! h! _7 Tpyglossary 不要用gtk界面,用命令行。" J) o9 c, ]6 T% o" o1 b$ ^- z
    + e! s7 B2 B# a
    $python3 main.py --ui=cmd
    0 k% N6 A- @1 j4 Q8 g  z
    python3 main.py --ui=cmd
    0 Q5 A( M4 J  x4 s7 L4 y9 N* K8 B/usr/local/bin/python3: can't open file '/Users/lemon/main.py': [Errno 2] No such file or directory
    & A4 l3 Z# q( n& S  z# ~2 ~lemon@lemondeMacBook-Pro ~ % python3 main.py --ui=cmd
    $ j% Q. ^6 s/ w4 Q- v' e' X/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 | 显示全部楼层
    先安装:% X1 L# n  G$ u6 H
    $python3 -m pip install pyglossary
    " e) ]8 f  g! e' |# i" t2 j7 N
    0 l& C( I; j" S( s5 d- ?安装成功,会显示:successfully installed
    8 u2 J4 ?' b5 l4 L6 a& s- G6 P, H5 g' P8 q4 I
    最后用命令行调用:
    6 F; @' x6 N0 w+ `# G* m& O
    7 J+ n! C9 u4 h& D9 g! D4 r$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/ a- c' H6 S) M, z! I' N0 ?
    先安装:& i/ h8 @; d( U$ `
    $python3 -m pip install pyglossary

    0 j& J' A) a2 P8 k5 | python3 -m pip install pyglossary * z1 ^, i0 j* N
    Requirement already satisfied: pyglossary in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (4.6.1)
    0 ?: Z/ u3 e6 o8 R0 Xlemon@lemondeMacBook-Pro ~ % $pyglossary --ui=cmd
    ( ?$ f% N4 h% i7 C6 b' C4 g8 |zsh: command not found: --ui=cmd
    ) H, Z, A  N2 y6 J2 q9 s( X
  • TA的每日心情

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

    [LV.8]以坛为家I

    发表于 2023-3-14 13:10:39 | 显示全部楼层
    $ 这个前缀表示这是一条命令行,直接运行:
    9 ]$ H1 G* b( D7 U4 i
    / g! N* {* F, @2 p& s: s/ `- Fpyglossary --ui=cmd
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2023-3-14 13:27:46 | 显示全部楼层
    mtaa 发表于 2023-3-14 13:10
    + ]: @4 z  `" N$ R* r6 ^  U$ 这个前缀表示这是一条命令行,直接运行:
    ( l6 |* U( n& ]8 j
    ; \" v3 J0 c0 `pyglossary --ui=cmd
    * T+ I' j0 N, V$ C+ A; Y
    pip3 install pyglossary7 U. D8 ?( V/ |- J- R& o( a0 f: h6 ~
    Requirement already satisfied: pyglossary in /usr/local/lib/python3.11/site-packages (4.6.1)- l8 s* w, h: v7 P
    lemon@lemondeMacBook-Pro ~ % pyglossary --ui=cmd, F% x; a& T1 s) j7 ~
    [CRITICAL] Traceback (most recent call last):2 S, F2 N) d" r' ?" I# Y" |
      File "/usr/local/bin/pyglossary", line 8, in <module>
    8 ~/ F9 |% w% o4 K    sys.exit(main())
    . D2 S: p/ x% l+ l             ^^^^^^
    + ^" a" T8 P9 C, ]7 Q  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/main.py", line 813, in main
    9 T  J) s  q4 D  @' u& G" ^    run = getRunner(args, ui_type)
    * T& F' w; f7 q0 F' M) m          ^^^^^^^^^^^^^^^^^^^^^^^^
    $ _& t, ]( u+ U5 s  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/main.py", line 285, in getRunner
    0 t8 h8 @9 ^, V% v' ^8 Z, a. C    from pyglossary.ui.ui_cmd_interactive import UI3 ^- p. U( b: Z. l1 D
      File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_cmd_interactive.py", line 62, in <module>  G4 N6 ?) C  C3 T" ]/ j
        import prompt_toolkit8 v9 ~  Y+ |! z& N
    ModuleNotFoundError: No module named 'prompt_toolkit'
  • TA的每日心情

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

    [LV.8]以坛为家I

    发表于 2023-3-14 13:45:54 | 显示全部楼层
    先装这个:
    ) ~+ h2 f( |2 |1 ~  i" Kpython3 -m pip install prompt_toolkit" w  ~3 a" ^* {$ }3 q

    9 M' X+ L1 t; K6 ]之后运行:
    ) h+ q; p& Z4 S9 Q+ P, u/ ~' a; Npyglossary --ui=cmd
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2023-3-14 14:26:03 | 显示全部楼层
    mtaa 发表于 2023-3-14 13:45
    ( o' Z% v7 A# Y$ G3 L6 I" r先装这个:  j0 r" _. h# {) b. S4 J
    python3 -m pip install prompt_toolkit
    % ]$ _) ~  z* o/ N7 Y8 J( Q
    python3 -m pip install prompt_toolkit4 J; P2 K: ~& Z8 s1 j" a$ n3 X
    Collecting prompt_toolkit
      z/ f/ M  w6 @# v6 N: p& a  Downloading prompt_toolkit-3.0.38-py3-none-any.whl (385 kB)
    , Q* ]3 Q5 R5 }, b+ C$ [* j9 _: j/ x     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 385.8/385.8 kB 714.2 kB/s eta 0:00:00' X" q# A5 H! s* j
    Collecting wcwidth
    9 T0 [, Z: u) T7 j  Downloading wcwidth-0.2.6-py2.py3-none-any.whl (29 kB)
    0 q* o* |# c2 h! jInstalling collected packages: wcwidth, prompt_toolkit
    % V- i& S5 W0 C5 gSuccessfully installed prompt_toolkit-3.0.38 wcwidth-0.2.60 ?2 {: @1 c& J  N3 f
    lemon@lemondeMacBook-Pro ~ % pyglossary --ui=cmd" c9 {8 h; i' t
    [CRITICAL] Traceback (most recent call last):$ m9 g8 V9 U% [) c( `& Q5 e+ [
      File "/usr/local/bin/pyglossary", line 8, in <module>: E# ^6 X* G2 \& u# N5 e/ J1 x& H
        sys.exit(main())4 b( O9 v% n+ S- z0 S# h
                 ^^^^^^
    + t; D* Z1 a3 H/ g( C, w( l- V  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/main.py", line 813, in main# f7 u4 r- K+ C: |6 ]
        run = getRunner(args, ui_type)
    0 d  q: w. }8 q+ s$ @. @' B1 Q          ^^^^^^^^^^^^^^^^^^^^^^^^
    6 E; B9 U9 r# ]0 B. S/ m, ]  File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/main.py", line 285, in getRunner
    " e! f4 O! T! ?    from pyglossary.ui.ui_cmd_interactive import UI# {: y% J. }' d6 n% [# H6 O( \- a8 M
      File "/usr/local/lib/python3.11/site-packages/pyglossary/ui/ui_cmd_interactive.py", line 62, in <module>8 o; L, n7 @$ O, D
        import prompt_toolkit/ x, [! t& Q/ u
    ModuleNotFoundError: No module named 'prompt_toolkit'
  • TA的每日心情

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

    [LV.8]以坛为家I

    发表于 2023-3-14 14:36:50 | 显示全部楼层
    你系统里python的环境混乱了。* d4 z8 W! Q5 ?
    再装一次:: x1 |2 W7 P4 _% S4 q' a3 p

    1 k, G* `+ u9 Z) Tpip3 install prompt_toolkit2 r% }. y9 D. s* p( S% @
    ) T3 A. q" M, K2 Q# ?+ b
    之后运行:6 F2 S% O! X! [
      s& [5 `/ ~' 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# a0 c) J% a; F
    你系统里python的环境混乱了。) T/ Y( Q3 D* {9 w- z
    再装一次:
    / s3 z& A6 |- Y/ S$ ?6 P. o
    > Input file: /Downloads/d.mdx
    ! \6 X- C9 H% p> Output file: /Downloads/d# G1 M* k0 z) t6 k
    > Output format: txt! i# c6 Z. D7 \* P- x+ g  M
    [ERROR] internal error: invalid format name/desc 'txt'3 h% T! N9 G' N& L0 N" @0 z  `
    > Output format:
    ; `# H7 S' \8 O4 {. |
  • TA的每日心情

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

    [LV.8]以坛为家I

    发表于 2023-3-14 15:30:29 | 显示全部楼层
    直接运行:1 Z0 s% r8 f' P

    7 d! y6 b$ Q  a4 k7 H3 w3 Hpyglossary ~/Downloads/d.mdx ~/Downloads/d.txt --read-format=OctopusMdict --write-format=Tabfile5 t) K& a  Y3 }( z, A, @
    / \, e0 b, m4 B6 ~! B
    会生成d.txt在下载目录里
  • TA的每日心情

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

    [LV.8]以坛为家I

    发表于 2023-3-14 15:33:28 | 显示全部楼层
    如果只是解压mdx/mdd的话,可以安装mdict-utils,更通用。
    - S$ H( r( P( G% I7 q4 R. f4 N# @/ o' Y$ h
    先安装:
    % C7 i% D- f+ R0 c' Vpip3 install mdict-utils
    * D- N' n# t  q8 J9 B7 Y- S' }
    / Q- q: P0 p3 v使用:
    % K+ l; d2 Y3 X7 [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 t+ K& ^) b1 E! ^: B; j, Z2 o直接运行:
    ; H1 T* q5 \8 N) p! r  F$ X" P2 T7 F( C/ d, N" @) D
    pyglossary ~/Downloads/d.mdx ~/Downloads/d.txt --read-format=OctopusMdict --write-format ...

    5 t, K8 t+ C5 Y里面全是代码,我想要的是纯文字内容。% z% V. L/ T) m  \) z8 W2 z
    这是转换好的:: [3 L- v! d2 @$ h) o$ k$ N
    $        <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 编辑 0 r8 A& C- q7 y4 ]: E" d7 v2 F/ o

    & E8 K0 h# |; m) g: L0 `用这个:+ D, e' F+ n% @4 y3 f+ J9 J
    pyglossary ~/Downloads/d.mdx ~/Downloads/d.txt --read-format=OctopusMdict --write-format=Tabfile --remove-html-all3 p. s; v$ P0 A( |7 B# R
    ) P7 |: l+ K( N: U5 u
    没有处理的HTML标签,用文本编辑器打开,替换掉就可以。
  • TA的每日心情
    开心
    2023-3-31 13:09
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2023-3-14 16:39:04 | 显示全部楼层
    mtaa 发表于 2023-3-14 16:13/ C( C! f! m+ f9 f$ E0 U
    用这个:
    6 {: l# V2 T' y1 vpyglossary ~/Downloads/d.mdx ~/Downloads/d.txt --read-format=OctopusMdict --write-format=Ta ...
    5 x/ _4 O9 R( q
    好的,非常感谢!!!昨天就到了导出文本全是代码的那步,查解决方法于是出现了调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-4-28 03:39 , Processed in 0.048632 second(s), 8 queries , MemCache On.

    Powered by Discuz! X3.4

    Copyright © 2001-2023, Tencent Cloud.

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