#8869 :Traceback (most recent call last):

175.197**3 Posted at: 16 hours ago

:
Traceback (most recent call last):
File "/Users/xiaohuo/pyvideotrans-main/videotrans/util/ListenVoice.py", line 16, in run

tts.run(

File "/Users/xiaohuo/pyvideotrans-main/videotrans/tts/__init__.py", line 324, in run

EdgeTTS(**kwargs).run()

File "", line 15, in init
File "/Users/xiaohuo/pyvideotrans-main/videotrans/tts/_edgetts.py", line 27, in post_init

super().__post_init__()

File "/Users/xiaohuo/pyvideotrans-main/videotrans/tts/_base.py", line 71, in post_init

self._cleantts()

File "/Users/xiaohuo/pyvideotrans-main/videotrans/tts/_base.py", line 76, in _cleantts

from videotrans.util.cn_tn import TextNorm

ModuleNotFoundError: No module named 'videotrans.util.cn_tn'


=
system:macOS-27.2.1-arm64-arm-64bit
version:v3.98
frozen:False
language:zh
root_dir:/Users/xiaohuo/pyvideotrans-main
Python: 3.10.19 (main, Feb 12 2026, 00:36:33) [Clang 21.1.4 ]

1 Replies

#1 DeepSeek reply at 16 hours ago

核心原因:源码目录中缺少 videotrans/util/cn_tn.py 文件,_base.py 在设置中文文本规范化(TextNorm)时导入该模块失败。通常有两种情况:源码包不完整/下载不完整,或当前源码是改造前的旧版本 v3.98(最新版已到 v4.19,目录结构有变动)。

排查与解决:

  1. 确认文件是否存在
    查看 /Users/xiaohuo/pyvideotrans-main/videotrans/util/ 目录下是否存在 cn_tn.py。若不存在,说明源码不完整,需重新拉取完整源码。
  2. 重新获取完整最新源码并重装依赖

    git clone https://github.com/jianchang512/pyvideotrans.git
    cd pyvideotrans
    uv sync
    uv run sp.py

    注意不要直接复用旧版本目录手动拼合文件,v3.98 与当前版本的模块结构差异较大。

  3. macOS 前置依赖(缺一不可,否则相关模块会导入失败)

    brew install libsndfile git openfst
    brew tap homebrew-ffmpeg/ffmpeg
    brew install homebrew-ffmpeg/ffmpeg/ffmpeg

    先装 openfst 再执行 uv sync,否则 pynini(cn_tn.py 依赖)会构建失败。

  4. 若 uv sync 时 pynini 反复构建失败
    可打开 pyproject.toml(约 256 行附近),删除 "pynini", 和 "WeTextProcessing", 两行内容后重新执行 uv sync。此操作会导致中文文本规范化(cn_tn)功能不可用,属于降级方案。
  5. 若确认 cn_tn.py 文件存在但仍报该错
    说明 _internal 或源码目录内残留了旧缓存,在 videotrans/ 目录内搜索 __pycache__,全部删除后重启软件。

请查阅相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Dondate via ko-fi.com

Related resource