Pydub安装和ffmpeg

2024-09-28 05:24:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图从.mp3文件中获取原始声音数据。因此,我使用了pydub模块,如here所述。我为这个项目创建了一个venv,并安装了所有必要的模块。但出于某种原因,pydub决定给我一个FileNotFoundError

(venv) Python-IT:LightsDev pythonit$ which python
/Users/pythonit/Documents/Programmieren/Python/LightsDev/venv/bin/python
(venv) Python-IT:LightsDev pythonit$ which pip3
/Users/pythonit/Documents/Programmieren/Python/LightsDev/venv/bin/pip3
(venv) Python-IT:LightsDev pythonit$ pip3 list 
------------- -------
ffmpeg        1.4
pip           18.1
pydub         0.23.0
pyee          5.0.0
python-ffmpeg 1.0.5
setuptools    39.0.1

就像我的密码:

^{pr2}$

我得到一个错误:

FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe': 'ffprobe'

除了此运行时警告:

RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)

我不知道是不是我,但是有些类似的问题说我应该安装ffmpeg或python ffmpeg是行不通的。我甚至可以导入ffmpeg模块,但是什么都没有发生。我可以使用ffmpeg并加载文件,但是在pydub中使用它是行不通的。在

编辑:今天我换上了我的windows机器,深入研究了这个错误。然而,我没能让它工作起来,即使在评论中提供了解决方案(谢谢你)。我如前所述安装了ffmpeg二进制文件,并且能够在shell中运行ffmpeg,但是不能使用pydub。。。我不知道发生了什么事。我想我的错误是很明显的,我就是不能理解。即使没有子进程也能解决这个问题,尽管我能够在shell中使用ffmpeg。我甚至可以在shell中使用ffmpeg转换文件。。。在

 ffmpeg -i test.mp3 test.wav 
 > Output #0, wav, to 'test.wav':

我想我自己也快要解决这个问题了,不过还是要谢谢你。在


Tags: 模块or文件totestvenv错误pip3

热门问题