You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行Tortoise-TTS遇OSError:无法加载libsndfile.dll(错误0x7e)

问题:运行Tortoise-TTS时出现libsndfile.dll加载失败错误

我运行Tortoise-TTS文本转语音程序,执行命令:

python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast

出现如下报错,程序无法启动:

C:\Users\chase\anaconda3\lib\site-packages\torchaudio\_internal\module_utils.py:99: UserWarning: Failed to import soundfile. 'soundfile' backend is not available.
  warnings.warn("Failed to import soundfile. 'soundfile' backend is not available.")
C:\Users\chase\anaconda3\lib\site-packages\paramiko\transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
Traceback (most recent call last):
  File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 152, in <module>
    _snd = _ffi.dlopen(_libname)
OSError: cannot load library 'C:\Users\chase\anaconda3\Library\bin\sndfile.dll': error 0x7e

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 178, in <module>
    _snd = _ffi.dlopen(_os.path.join(_path, '_soundfile_data', _packaged_libname))
OSError: cannot load library 'C:\Users\chase\anaconda3\lib\site-packages\_soundfile_data\libsndfile_64bit.dll': error 0x7e

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\chase\tortoise-tts\tortoise\do_tts.py", line 7, in <module>
    from api import TextToSpeech, MODELS_DIR
  File "C:\Users\chase\tortoise-tts\tortoise\api.py", line 22, in <module>
    from tortoise.utils.audio import wav_to_univnet_mel, denormalize_tacotron_mel
  File "C:\Users\chase\anaconda3\lib\site-packages\tortoise-2.4.2-py3.9.egg\tortoise\utils\audio.py", line 4, in <module>
    import librosa
  File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\__init__.py", line 209, in <module>
    from . import core
  File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\core\__init__.py", line 6, in <module>
    from .audio import *  # pylint: disable=wildcard-import
  File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\core\audio.py", line 8, in <module>
    import soundfile as sf
  File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 189, in <module>
    _snd = _ffi.dlopen(_libname)
OSError: cannot load library 'libsndfile.dll': error 0x7e

解决方案

  • 修复soundfile依赖(优先用conda安装)

    1. 卸载当前可能损坏的soundfile:
      pip uninstall soundfile -y
      
    2. 通过conda重新安装,确保动态库正确配置:
      conda install -c conda-forge soundfile
      
  • 手动安装libsndfile库(如果上述方法无效)

    1. 直接安装libsndfile的系统级库:
      conda install -c conda-forge libsndfile
      
    2. 检查Anaconda的Library/bin目录(比如C:\Users\chase\anaconda3\Library\bin)是否在系统PATH环境变量中,若没有则添加。
  • 处理paramiko警告(可选)
    更新paramiko到最新版本,消除Blowfish弃用警告:

    pip install --upgrade paramiko
    

内容的提问来源于stack exchange,提问作者cabaldev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 06:20:26