why am i getting error when importing AudioSegment?

浪尽此生 提交于 2019-12-06 11:16:35

Can u uninstall and try installing using pip install pydub. Also make sure pydub path is in the PYTHONPATH or system PATH. What OS are you using?

find out where pydub got installed.
I've in C:\Python27\Lib\site-packages\pydub.
Open a command-prompt and type in ,
set PATH=c:\Python27\Scripts;c:\Python27\Lib;C:\Python27\Lib\sit‌​e-packages\pydub;%PA‌​TH%

Then try running pydub program on cmd screen. Once successful you will need to add pydub path to system environment variables section.

Also for error:

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)

Looks like pydub cant find ffmpeg or avconv. You may need to install or add path to system. If it's working I would let it be. It's just warning anyway

user3251696

I was also getting the same issue .and it was coming due to ffmpeg was not correctly configured. i have download latest ffmpeg from official website https://www.ffmpeg.org/download.html and setting up the class path worked for me

What worked for me was:

  1. Google for a suitable ffmpeg download. I needed a windows 64 bit package, which I downloaded from https://ffmpeg.zeranoe.com/builds/
  2. Opened the downloaded zip file. Then took the files inside the bin folder and placed those inside the pydub folder.

Since i have already placed pydub in the system PATH previously, this removed the need to update the system PATH. The files can be placed elsewhere and that should work as well as long as the PATH is updated.

I'm getting the same error because ffmpeg wasn't installed on my MAC. Installed it with brew install ffmpeg and fixed the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!