#4478 D:\tools\whisperx-api>uv run app.py'uv' 不是内部或外部命令,也不是可运行的程序或批处理文件。

103.3* Posted at: 6 hours ago 👁87

D:\tools\whisperx-api>uv run app.py
'uv' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

19 Replies

显示了版本号,但执行还是提示'uv' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

我发现直接打开终端,uv命令有效,但进入whiperxapi的文件夹内,再打开终端输入命令就无效了

运行了,但是有新的问题,如下
D:\tools\whisperx-api>uv run app.py
Using CPython 3.14.0
Creating virtual environment at: .venv
error: Distribution torch==2.8.0 @ registry+“双引号里这段是网址链接,不改发不了提问" can't be installed because it doesn't have a source distribution or wheel for the current platform

hint: You're using CPython 3.14 (cp314), but torch (v2.8.0) only has wheels with the following Python ABI tags: cp312, cp313, cp313t

右键记事本打开 pyproject.toml,将 requires-python = ">=3.12" 改为 requires-python = "==3.12.*"

谢谢站长回复,之后再借助ai已经跑起来了,但如何切换cpu模式到gpu模式使用n卡运行?

按步骤在 whisperx-api 目录下(激活虚拟环境或用 uv):

uv pip uninstall torch
uv pip install torch==2.8.0 --index-url “双引号里这段是网址链接,不改发不了提问"

然后
D:\tools\whisperx-api>set WHISPERX_DEVICE=cuda

D:\tools\whisperx-api>uv run app.py
D:\tools\whisperx-api.venv\Lib\site-packages\pyannote\audio\core\io.py:212: UserWarning: torchaudio._backend.list_audio_backends has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release.
torchaudio.list_audio_backends()
2026-05-08 18:31:58,582 - INFO - 成功从 token.txt 文件中读取 Hugging Face 令牌。
2026-05-08 18:31:58,582 - INFO - 使用设备: cpu,计算类型: int8
2026-05-08 18:31:58,582 - INFO - FFmpeg 环境检查通过。
2026-05-08 18:31:58,582 - INFO - 服务已启动,正在监听 http://127.0.0.1:9092
2026-05-08 18:31:58,582 - INFO - Serving on http://127.0.0.1:9092

还是cpu模式

输出 False,如何重新安装

D:\tools\whisperx-api>uv pip install torch==2.8.0 torchvision==0.22.0 torchaudio==2.8.0 --index-url ht tps://do wnload.pytorc h.org/whl/cu128
x No solution found when resolving dependencies:
`-> Because torchvision==0.22.0 depends on torch==2.7.0 and you require torch==2.8.0, we can conclude that your

  requirements and torchvision==0.22.0 are incompatible.
  And because you require torchvision==0.22.0, we can conclude that your requirements are unsatisfiable.

不行啊。验证这一步就还是false

  1. 删掉 whisperx-api 目录下的venv 文件夹
  2. 记事本打开 pyproject.toml, 将 >=3.12 改为 ==3.12.* 保存
  3. 打开cmd执行 uv sync
  4. 完成后执行 uv pip uninstall -y torch
  5. 执行uv pip install torch==2.7 --index-url https://download.pytorch.org/whl/cu128

站长大大,反复试了还是不行,有几个问题
一是3.12.*不行会报错,问了ai改成加上“,

站长大大,反复试了还是不行,有几个问题
一是3.12.*不行会报错,问了ai改成加上“,

站长大大,反复试了还是不行,有几个问题
一是3.12.*不行会报错,问了ai改成加上小于3.13,并且加了path
二是,无论在么删除torch重新安装,成功是成功了,最后还是false,启动还是cpu模式。
附上配置吧,5700x的cpu加上64g内存加3080显卡,之前用您的软件时都是按您文档里的指南装了cuda12.8和cudnn9.11的,完全按步骤配置的,由于研究了一下据说whisperx的断句能力更强所以希望配置使用,之前用别的虽然偶尔有卡住不动的情况,但cuda加速跑fasterwhisper、openai whisper、qwen-asr都没问题。就写一下排除一下硬件原因。

别的没什么了,这个启动成功了就是不能切换到gpu模式

发现可能是最后运行的时候的问题?尝试结果和之前一样,检查是cpu版本,然后卸载重新按命令安装,最后运行,运行时会有D:\tools\whisperx-api>uv run app.py
Uninstalled 1 package in 1.20s
Installed 1 package in 1.90s
这个记录,感觉是又把正确的版本删了换回了cpu版本?没辙了。。

--照下面命令安装,启动时不要使用 uv run app.py ,

这样启动

  1. venv\scripts\activate执行,执行后命令上前面会多一个 (whisperx-api)
  2. 然后再使用这个命令启动 python app.py

以后每次打开cmd 都这样启动

uv pip list|findstr torch 执行这个命令,看看输出什么

默认安装的是 cpu版本的torch,必须先卸载 uv pip uninstall -y torch,然后再安装uv pip install torch==2.7.0 --index-url https://download.pytorch.org/whl/cu128

要放弃了。。又试了好多遍,用这个方式运行还是cpu int8模式,还问了各大AI,各种清干净再重新安装正确版本。无论是严格按照你这边操作还是按ai的方式操作,到最后运行虽然没有之前使用uv run app.py时重新删除又安装的自动操作了。但是启动后还是cpu模式。

使用GPU模式失败是因为 WHISPERX_DEVICE=cuda 环境变量未生效或torch实际安装仍是CPU版本。

验证与修复步骤:

  1. 确认torch是否真正为GPU版:

    • 激活虚拟环境后执行 python -c "import torch; print(torch.cuda.is_available())"
    • 若返回 True 则说明torch已正确安装CUDA版,问题在于环境变量读取。
  2. 若返回 False

    • 卸载CPU版torch:uv pip uninstall -y torch torchvision torchaudio
    • 重新安装CUDA版:uv pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128
    • 安装完后再次验证 python -c "import torch; print(torch.cuda.is_available())" 应为 True
  3. 若torch正确,启动时手动指定device:

    • 打开 whisperx-api 目录下的 app.py,在文件开头(import后)添加一行:
      os.environ['WHISPERX_DEVICE'] = 'cuda'
    • 保存后使用 python app.py 启动。
  4. 强烈建议改用pyVideoTrans内置的faster-whisper本地识别渠道
    该渠道开箱即用支持CUDA加速,无需额外部署whisperx-api服务,且断句效果经过优化。在软件主界面语音识别渠道选择 faster-whisper(本地),模型选 large-v3,并勾选CUDA加速即可获得GPU加速。

如果仍有问题,请提供 whisperx-api 目录下 logs/ 文件夹中的最新日志(底部约30行),以便进一步分析。

力竭了。。话说这里反复删装torch相关的东西会影响主程序pytransvideo的运行和cuda加速吗?不影响的话,是不是把文件夹删了,继续使用其他asr就行了?
顺便恳求站长大大把whisperx直接打包进主程序。。谢谢谢谢谢谢

不影响主程序 pyVideoTrans 的运行和 CUDA 加速。两者环境独立,删除 whisperx-api 文件夹即可,主程序正常使用其他 ASR 渠道。whisperx 暂未计划打包进主程序,请继续使用 faster-whisper 本地渠道,已支持 CUDA。

Post Your Reply
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.

Related resource