#5004 httpx.ConnectError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

104.160* Posted at: 19 hours ago

连接被拒绝,目标服务可能未运行或端口错误:
Traceback (most recent call last):
File "httpx\_transports\default.py", line 101, in map_httpcore_exceptions
File "httpx\_transports\default.py", line 250, in handle_request
File "httpcore\_sync\connection_pool.py", line 216, in handle_request
File "httpcore\_sync\connection_pool.py", line 196, in handle_request
File "httpcore\_sync\connection.py", line 99, in handle_request
File "httpcore\_sync\connection.py", line 76, in handle_request
File "httpcore\_sync\connection.py", line 122, in _connect
File "httpcore\_backends\sync.py", line 205, in connect_tcp
File "contextlib.py", line 153, in exit
File "httpcore\_exceptions.py", line 14, in map_exceptions
httpcore.ConnectError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "videotrans\util\ListenVoice.py", line 16, in run
File "videotrans\tts\__init__.py", line 184, in run
File "videotrans\tts\_base.py", line 134, in run
File "videotrans\tts\_base.py", line 215, in _item_task
File "videotrans\tts\_index.py", line 29, in _run
File "tenacity\__init__.py", line 338, in wrapped_f
File "tenacity\__init__.py", line 477, in call
File "tenacity\__init__.py", line 378, in iter
File "tenacity\__init__.py", line 400, in
File "concurrent\futures\_base.py", line 451, in result
File "concurrent\futures\_base.py", line 403, in __get_result
File "tenacity\__init__.py", line 480, in call
File "videotrans\tts\_gradio.py", line 50, in _send
File "videotrans\tts\_gradio.py", line 35, in get_thread_client
File "gradio_client\client.py", line 162, in init
File "gradio_client\client.py", line 935, in _get_config
File "httpx\_api.py", line 195, in get
File "httpx\_api.py", line 109, in request
File "httpx\_client.py", line 825, in request
File "httpx\_client.py", line 914, in send
File "httpx\_client.py", line 942, in _send_handling_auth
File "httpx\_client.py", line 979, in _send_handling_redirects
File "httpx\_client.py", line 1014, in _send_single_request
File "httpx\_transports\default.py", line 249, in handle_request
File "contextlib.py", line 153, in exit
File "httpx\_transports\default.py", line 118, in map_httpcore_exceptions
httpx.ConnectError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。


=
system:Windows-10-10.0.19045-SP0
version:v4.01
frozen:True
language:zh
root_dir:D:/BaiduNetdiskDownload/win-pyvideotrans-v4.01-0602

9 Replies

这是典型的 本地 TTS 服务未运行或地址配置错误 导致的连接失败。

你选择的配音渠道( _index.py 对应的是 Index-TTSF5-TTS / Index-TTS / VoxCPM-TTS / Spark-TTS / Dia-TTS 等共用设置面板的本地 API 渠道)需要你 自行在本地计算机上部署并启动对应的服务(如 Gradio WebUI),然后在 pyVideoTrans 的 菜单 -> TTS设置 -> 对应渠道的设置面板 中填写正确的 API 地址(例如 http://127.0.0.1:7860)。

解决方法:

  1. 确认服务已启动:检查你部署的 Index-TTS(或其他 TTS 工具)的终端窗口是否仍在运行,没有被关闭或崩溃。
  2. 核对地址和端口

    • 打开 pyVideoTrans 软件,进入 菜单 → TTS设置 → F5-TTS 设置(Index-TTS 也共用该面板)。
    • 确认 API 地址 一栏填写的内容与你启动服务时显示的地址完全一致。默认通常是 http://127.0.0.1:7860,如果端口被占用可能不同。
  3. 重启服务:如果地址正确但仍报错,尝试完全关闭服务并重新启动,再重新试听或执行配音。

请查阅相关文档:

Active code page: 65001
开始启动,用时可能较久,请耐心等待...
检测模型是否下载,若未下载,将从hf-mirror.com下载...
Failed to canonicalize script path
Press any key to continue ...

根据错误信息“Failed to canonicalize script path”,这是 Windows 系统在解析脚本路径时失败,通常由以下原因引起:

  1. 路径包含中文、空格或特殊符号 — 启动脚本的完整路径中若有这些字符,会导致脚本无法被正确识别。
  2. 路径过长 — 脚本所在目录层级太深或文件名太长,超过 Windows 命令行长度限制(约 260 个字符)。
  3. 权限不足 — 脚本位于需要管理员权限的目录(如 C:\Program Files)。

解决方法

  1. 精简并规范路径

    • 将整个服务目录(包括 Index-TTS 等工具)移动到一个纯英文、无空格、无特殊符号的短路径下,例如 D:\index-tts
    • 确保文件夹名称和内部文件名均为英文或数字。
  2. 缩短文件名

    • 如果批处理文件或 Python 脚本本身文件名过长,重命名为简短名称,如 start.bat
  3. 以管理员身份运行

    • 右键点击启动脚本(.bat.cmd),选择“以管理员身份运行”。
  4. 检查 Python 环境

    • 确保 Python 已正确安装且已添加到系统环境变量。在命令行中执行 python --version 确认。

如果上述操作后仍然报错,请提供以下信息以便进一步排查:

  • 启动脚本的完整路径(可用截图或文字说明)。
  • 软件根目录下 logs/ 文件夹中最新的日志文件内容(底部约 30 行)。

tive code page: 65001
干始启动,用时可能较久,请耐心等待...
金测模型是否下载,若未下载,将从hf-mirror.com下载...
rror: Failed to spawn: f5-tts_infer-gradio
Caused by: program not found
ress any keyto continue...

这个错误说明系统找不到 f5-tts_infer-gradio 这个可执行程序。通常有以下原因:

  1. 部署不完整:你没有正确安装该 TTS 工具的依赖,或者未在正确的目录下启动。
  2. 启动命令不对:启动脚本中使用了错误的程序名或路径。
  3. 环境问题:Python 环境未激活,或 uv 等依赖管理器未正确安装。

解决方法:

  • 确保已正确部署 F5-TTS / Index-TTS 服务
    参考官方文档:https://pyvideotrans.com/f5tts
    关键步骤:

    • 克隆仓库到纯英文路径
    • 使用 uv syncpip install -r requirements.txt 安装依赖
    • 运行启动命令(例如 uv run f5-tts_infer-gradio.pypython f5-tts_infer-gradio.py
  • 检查当前目录
    你的启动脚本(.bat 或 .cmd)必须放在 F5-TTS 项目根目录下,且该目录下存在 f5-tts_infer-gradio.py 文件。
  • 重新下载完整包
    如果是从网盘下载的整合包,可能缺少文件。建议从官方渠道重新下载最新完整包,覆盖后重试。
  • 确认 Python 环境
    在命令行中执行 python --versionuv --version,确保它们可用。

如果问题持续,请提供启动脚本的内容或截图,以及 logs/ 文件夹中的报错日志(底部 30 行)。

检测模型是否下载.….。
Active_codepa:65001
Builtindextts @_file:///D:/BaiduNetdisk


/indextts2-0529
Uninstalled l package _in lms
[o/i]Instal1ingwheels...
warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
If the cache and target direçtories are on different filesystems, hardlinking mạy not be supported.
If this isintentional, set "export UV_LINK_MODE=copy or use"--link-mode-copy to suppress this warning.
lInstalled 1 package in 14ms
Failed to canonicalize script path
开始启动,用时可能较久,请耐心等待...
Model directory ./checkpoints does not exist. Please download the model first.
Press any key to continue..

错误核心非常明确:模型文件夹 ./checkpoints 不存在。你启动的 Index-TTS 服务需要先下载模型,但并未自动完成。请按以下步骤手动解决。

解决方法

  1. 从官方仓库下载模型
    Index-TTS 模型的默认下载地址为 https://huggingface.co/IndexTeam/IndexTTS(国内无法直接访问时,可使用镜像站 hf-mirror.com)。
    将页面中 checkpoints/ 目录下的所有文件及子文件夹全部下载下来。
  2. 放置到正确目录
    在 Index-TTS 项目根目录(即 indextts2-0529 文件夹)下,创建一个名为 checkpoints 的文件夹,然后将下载的所有模型文件放入该文件夹内。最终路径应类似:

    D:\BaiduNetdisk\indextts2-0529\checkpoints\...
  3. 重启启动脚本
    确保 checkpoints 文件夹内容完整后,再次双击你的启动脚本(或执行命令)。如果提示依赖未安装,先执行 uv sync 或按文档安装依赖。
  4. 注意路径规范
    你的软件目录 D:\BaiduNetdisk\indextts2-0529 路径中包含中文,建议改为纯英文路径(如 D:\indextts2),否则可能引起其他异常。修改后需要重新解压或移动并更新启动脚本中的路径。

如果仍然失败

  • 检查是否需要额外依赖(如 uv sync --all-extras)。
  • 打开 Index-TTS 的官方文档,确认模型下载方式:IndexTTS 使用说明
  • 提供日志文件 logs/ 的最新内容(底部 30 行)以便进一步分析。

HuggingFace 国内无法直接访问,请使用国内镜像站 hf-mirror.com 下载模型。

解决方法

  1. 打开浏览器访问:
    https://hf-mirror.com/IndexTeam/IndexTTS/tree/main
  2. 在页面中找到 checkpoints 文件夹,点击进入。
  3. 下载该文件夹内的 所有文件和子文件夹(通常包括多个 .bin.json 等文件)。
  4. 在你的 Index-TTS 项目目录(例如 D:\indextts2-0529)下创建 checkpoints 文件夹,将下载的文件全部放入其中。
  5. 确保 checkpoints 文件夹路径为:
    D:\indextts2-0529\checkpoints\
  6. 重新双击启动脚本运行。

建议:将整个项目目录改为纯英文路径(如 D:\indextts2),避免路径含中文引发其他问题。

如果下载文件夹不方便,也可以使用 git lfs 拉取整个仓库(需先安装 git-lfs):

git clone --depth 1 https://hf-mirror.com/IndexTeam/IndexTTS

然后切换到 checkpoints 目录内执行 git lfs pull

模型下载并放置正确后,重新启动服务即可。

Post Your Reply