How do I download pydub from PyCharm 2022.1.3?

87 views Asked by At

This is my first time asking a question in Stack Overflow. I was trying to convert from wav to mp3 but when I wanted to download pydub it shows a syntax error. What should I do in this situation?

pip download pydub
from pydub import AudioSegment
AudioSegment.converter = "REDACTED.wav"

wav = AudioSegment.from_wav(Path)
wav.export(r"REDACTED.mp3",format="mp3")

pip download pydub ^ SyntaxError: invalid syntax

I expect to make sure that pydub can work after the download and hoping to convert the rest wav files to mp3 automatically without any websites.

2

There are 2 answers

1
Emre E On

Oh I see now. you are trying to download pip download pydub. Instead execute the code in the terminal as:

pip install pydub

if you are using colab: !pip install pydub

0
Vulpex On

So after getting the confusion cleared up in the comments.

I'm assuming you're running on Windows in this scenario, what you want to do: Open a Terminal and write the command python -m pip install pydub This will install the package to the default enviornment. After that you can import the package in your python script and run it with your code above.

What you've tried above, at least I assume, is to run the pip install command from within your script, for that to work you'll have to open a subprocess and pass the command I've shown above with the code from the possible duplicate link I've commented.