0
39 次浏览

你好!
在 Ubuntu 24.04.2 LTS 上,我安装了 PTXprint,版本是昨天的(python3-ptxprint/noble,noble,now 2.8.20-0~20250709~ubuntu24.04.1 all [installed]),但它拒绝启动。一周前开始出现这个问题。我的系统上没有 usfmtc 文件。

pc@pc:~/Dokumenti/GitHub/SloKJV/PTXprint$ ptxprint
Traceback (most recent call last):
  File "/usr/bin/ptxprint", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3/dist-packages/ptxprint/main.py", line 145, in main
    from ptxprint.gtkview import GtkViewModel, getPTDir, reset_gtk_direction
  File "/usr/lib/python3/dist-packages/ptxprint/gtkview.py", line 29, in <module>
    from ptxprint.view import ViewModel, Path, VersionStr, GitVersionStr
  File "/usr/lib/python3/dist-packages/ptxprint/view.py", line 3, in <module>
    from ptxprint.texmodel import TexModel, Borders, _periphids
  File "/usr/lib/python3/dist-packages/ptxprint/texmodel.py", line 7, in <module>
    from ptxprint.usxutils import Usfm, Sheets
  File "/usr/lib/python3/dist-packages/ptxprint/usxutils.py", line 2, in <module>
    import usfmtc
ModuleNotFoundError: No module named 'usfmtc'

从 pip 安装没有帮助(Python 3.12.3)

pc@pc:~/Dokumenti/GitHub/SloKJV/PTXprint$ python3 -m pip install usfmtc
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.


    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.


    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.


    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

我在 GitHub - sillsdev/ptx2pdf: XeTeX based macro package for typesetting USFM formatted (Paratext output) scripture files
https://github.com/sillsdev/ptx2pdf/tree/master 上找不到这个文件

看起来 /usr/lib/python3/dist-packages/ptxprint/usxutils.py 正在使用它

==========usxutils.py=======
import re, regex, logging, os, time
import usfmtc
from usfmtc.reference import Ref, RefList
from usfmtc.usfmparser import Grammar
from ptxprint.utils import universalopen, runChanges
from usfmtc.xmlutils import ParentElement, hastext, isempty
from usfmtc.usxmodel import iterusx, addesids
from ptxprint.changes import readChanges
from ptxprint.ptsettings import PTEnvironment
from copy import deepcopy
...
===========================

机器翻译自 English
PTXprint (104 分) 发布
已编辑 发布 | 39 次浏览

1 个回答

0
我们需要在这方面做得更好,可能通过打包 usfmtc 来实现。在此期间,使用命令行选项或将 /usr/lib/python3.12/EXTERNALLY-MANAGED(或类似文件)重命名为其他名称来解除锁定是安全的。这将允许安装该包。
机器翻译自 English
(656 分) 发布

现在可以正常工作了。谢谢。

root@pc:/usr/lib/python3.12# oot@pc:/usr/lib/python3.12# mv EXTERNALLY-MANAGED EXTERNALLY-MANAGED_RENAMED
root@pc:/usr/lib/python3.12# python3 -m pip install usfmtc
Collecting usfmtc
  Downloading usfmtc-0.3.12-py3-none-any.whl.metadata (1.2 kB)
Collecting rply (from usfmtc)
  Downloading rply-0.7.8-py2.py3-none-any.whl.metadata (4.2 kB)
Requirement already satisfied: regex in /usr/lib/python3/dist-packages (from usfmtc) (2022.10.31)
Requirement already satisfied: appdirs in /usr/lib/python3/dist-packages (from rply->usfmtc) (1.4.4)
Downloading usfmtc-0.3.12-py3-none-any.whl (83 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.7/83.7 kB 1.2 MB/s eta 0:00:00
Downloading rply-0.7.8-py2.py3-none-any.whl (16 kB)
Installing collected packages: rply, usfmtc
Successfully installed rply-0.7.8 usfmtc-0.3.12
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@pc:/usr/lib/python3.12# root@pc:/usr/lib/python3.12# mv EXTERNALLY-MANAGED_RENAMED EXTERNALLY-MANAGED
机器翻译自 English

相关问题

0
1 个回答 21 次浏览
我正在使用 Ubuntu 25.04,并像这样安装了 ptxprint: sudo apt install python3-ptxprint 当我尝试通过运行 ptxprint 来启动它时,遇到了这个错误: /usr/lib ... 04 附带的是 Python 3.13 该版本的 Python 中,pathlib 没有 _posix_flavour 属性
bit 495 发布 提问于 十月 8, 2025
0
1 个回答 114 次浏览
我有一个历书圣经模块,其中包含自己的 \s# 标题 模块中没有 \inc s ,因为我不希望显示经文中的 \s# 标题 然而,PTXPrint 仍然显示了那些经文的 \s# 标题 如果我在 正文 选项卡中取消勾选 章节标题 ,则不会显 ... 标题 我目前的变通方法是将模块中所有的 \s# 标题替换为 \ms# 标题 但我在想,我是不是漏掉了某个设置?
beve 128 发布 提问于 四月 10, 2025
0
2 个回答 70 次浏览
在历书圣经模块中,我们有包含经文引用的标题 例如: \s1 $(JER 33:14-18) 项目中用于平行经文的经文引用设置被设为 短名称 ,因此输出应为 耶利米书 33:14-18 ,但实际输出却是缩写形式 耶利米书 33:14- ... 原文指缩写形式,如 Jer.) 我尝试过 \ms# 和 \s# 标题,输出结果相同 我使用的是版本 2.7.29
beve 128 发布 提问于 四月 16, 2025
0
1 个回答 126 次浏览
我有一个读经日历(lectionary)圣经模块,在 PTXPrint 中,一些 \ref 文本缺失,还有一些显示的经文数量多于 \ref 行所指定的 所有 \ref 文本在 Paratext 预览输出(Preview Output)中都能正确显示 我们发现 ... 否则它会一直显示到下一个段落标记为止 是不是有什么关于段落或其他方面的设置我遗漏了?
beve 128 发布 提问于 四月 10, 2025
0
1 个回答 59 次浏览
我们正在开发一个圣经模块,并升级到 v 2.5.6 以让脚注显示在 PDF 中 现在脚注可以正常显示了,但我们后来才注意到章节标题不再出现了!无论我们使用 \s 还是 \s1,似乎都没有区别 只有那些我们在 module.sfm 文件中为缺 ... 来说能正常工作的最新版本是 2.6.6,在这个版本中我也遇到了同样的问题--脚注可以显示,但章节标题不显示 )
anon399461 123 发布 提问于 十一月 20, 2024
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
Don’t you know that you yourselves are God’s temple and that God’s Spirit dwells in your midst?
1 Corinthians 3:16
3,046 个问题
6,006 个回答
5,671 条评论
2,026 位用户