i'm trying to use pydub, but when i import it to python with AudioSegment it will give me an error saying it doesn't recognize it. i tried using pip install and searching online. any help?? i'm using python 2.7
from pydub import AudioSegment
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\site-packages\pydub;%PATH%
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
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:
- Google for a suitable ffmpeg download. I needed a windows 64 bit package, which I downloaded from https://ffmpeg.zeranoe.com/builds/
- 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.
来源:https://stackoverflow.com/questions/43169620/why-am-i-getting-error-when-importing-audiosegment