Could not find module '.../libtorchaudio_ffmpeg.pyd' | RuntimeError: StreamReader requires FFmpeg extension which is not available.

Windows中使用torchaudio.io.StreamReader时报错:

FileNotFoundError: Could not find module 'D:\software\miniconda3\envs\pytorch\Lib\site-packages\torchaudio\lib\libtorchaudio_ffmpeg.pyd' (or one of its dependencies). Try using the full path with constructor syntax.

RuntimeError: StreamReader requires FFmpeg extension which is not available. Please refer to the stacktrace above for how to resolve this.

提示libtorchaudio_ffmpeg.pyd这个东西找不到,但是查看目录里明明是有的

我的解决方案

https://anaconda.org/conda-forge/ffmpeg

执行以下任意一条命令

conda install conda-forge::ffmpeg
conda install conda-forge/label/broken::ffmpeg
conda install conda-forge/label/cf201901::ffmpeg
conda install conda-forge/label/cf202003::ffmpeg
conda install conda-forge/label/gcc7::ffmpeg

参考

Torchaudio fails to find FFmpeg when installed via poetry #3195
TorchAudio does not pick up ffmpeg #3016
试图本地运行时出现DEBUG:torchaudio._extension:Failed to initialize ffmpeg bindings #144

posted @ 2024-04-30 10:40  junlin623  阅读(285)  评论(0编辑  收藏  举报