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 來啟動 ptxprint 時,遇到了這個錯誤: ... 設搭載 Python 3.13 此版本的 Python 中,pathlib 模組沒有 _posix_flavour 屬性
bit 495 提出 已提問 10月 8, 2025
0
1 個回答 114 次瀏覽
我有一個課讀經(lectionary)聖經模組,其中包含自己的 \s# 標題 該模組中沒有 "\inc s",因為我不希望顯示經文中的 \s# 標題 然而,PTXPrint 仍然顯示了那些經文的 \s# 標題 如果我在「正文」(Body)分頁中 ... 我目前的變通方法是將模組中所有的 \s# 標題替換為 \ms# 標題 但我不確定是否遺漏了某個設定?
beve 128 提出 已提問 4月 10, 2025
0
2 個回答 70 次瀏覽
在讀經表(lectionary)聖經模組中,我們有包含經文引用的標題 例如: \s1 $(JER 33:14-18) 專案中「平行經文」(Parallel Passages)的經文引用設定為「短名」(Short name),因此輸出結果應為「耶利米書 ... 18) 我嘗試過 \ms# 和 \s# 標題,輸出結果相同 我使用的是 2.7.29 版本
beve 128 提出 已提問 4月 16, 2025
0
1 個回答 126 次瀏覽
我有一個課讀經(lectionary)聖經模組,在 PTXPrint 中,有些 \ref 文字遺失了,有些則顯示了比 \ref 行指定的更多節數 所有 \ref 文字在 Paratext 預覽輸出(Preview Output)中都能正確顯示 我們發現,只有 ... \p,否則它會一直顯示到下一個段落標記為止 是不是有什麼關於段落或類似的設定我漏掉了?
beve 128 提出 已提問 4月 10, 2025
0
1 個回答 59 次瀏覽
我們正在開發一個聖經模組,並升級到 v 2.5.6 以讓腳註顯示在 PDF 中 現在腳註可以正常顯示,但我們後來才注意到章節標題不再出現了!無論我們使用 \s 還是 \s1,似乎都沒有差別 唯一能顯示的,是我們在 module.sfm 檔案 ... 對我能正常運作的最新版本是 2.6.6,而在這個版本中我遇到同樣的問題--腳註可以顯示,但章節標題無法顯示 )
anon399461 123 提出 已提問 11月 20, 2024
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
For where two or three gather in my name, there am I with them.
Matthew 18:20
3,046 個問題
6,006 個回答
5,671 則評論
2,026 位使用者