点击查看 Edge-TTS 配音渠道无法使用的解决办法!!!

#2000 import torchaudioTraceback (most recent call last): File "C:\Users\zqpzq\AppData\Local\Programs\Python\Python310\lib\si

240e:3bc* Posted at: 1 day ago 👁19
import torchaudio
Traceback (most recent call last):
File "C:\Users\zqpzq\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\_ops.py", line 1488, in load_library
ctypes.CDLL(path)

File "C:\Users\zqpzq\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in init

self._handle = _dlopen(self._name, mode)

FileNotFoundError: Could not find module 'C:\Users\zqpzq\AppData\Local\Programs\Python\Python310\Lib\site-packages\torchaudio\lib\libtorchaudio.pyd' (or one of its dependencies). Try using the full path with constructor syntax.

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

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\zqpzq\AppData\Local\Programs\Python\Python310\lib\site-packages\torchaudio\__init__.py", line 7, in

from . import _extension  # noqa  # usort: skip

File "C:\Users\zqpzq\AppData\Local\Programs\Python\Python310\lib\site-packages\torchaudio\_extension\__init__.py", line 37, in

_load_lib("libtorchaudio")

File "C:\Users\zqpzq\AppData\Local\Programs\Python\Python310\lib\site-packages\torchaudio\_extension\utils.py", line 58, in _load_lib

torch.ops.load_library(path)

File "C:\Users\zqpzq\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\_ops.py", line 1490, in load_library

raise OSError(f"Could not load this library: {path}") from e

OSError: Could not load this library: C:\Users\zqpzq\AppData\Local\Programs\Python\Python310\Lib\site-packages\torchaudio\lib\libtorchaudio.pyd

print(torchaudio.__version__)
Traceback (most recent call last):
File "", line 1, in
NameError: name 'torchaudio' is not defined

1 Replies

您遇到的 torchaudio 模块加载错误,通常是由于 PyTorch 和 torchaudio 版本不匹配,或者 torchaudio 安装不完整/损坏所致。这会影响软件中依赖 torchaudio 的功能(如某些语音处理模块)。

请按以下步骤解决:

  1. 卸载现有版本:在命令行中执行以下命令,确保完全卸载。

    pip uninstall torch torchaudio torchvision -y
  2. 重新安装匹配版本:访问 PyTorch 官网 (https://pytorch.org/get-started/locally/),根据您的 CUDA 版本(或选择 CPU 版本)获取正确的安装命令。例如,对于 CUDA 11.8,命令可能如下:

    pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

    关键:确保 torchtorchaudio 来自同一命令,以保证版本兼容。

  3. 验证安装:安装后,重新打开 Python 并运行 import torchaudioprint(torchaudio.__version__),应不再报错。

如果问题依旧,可能是 Python 环境混乱。建议为 pyVideoTrans 创建一个全新的虚拟环境,并在其中按照上述步骤安装 PyTorch。

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.

Donate: https://ko-fi.com/jianchang512

Trending Questions