ModuleNotFoundError: No module named 'simpleaudio'

4.5k Views Asked by At

Basically, I recently started Python. I'm working on a project where I need audio to play. I searched up some libraries that can play audio and tried simpleaudio. I'm using Windows and sucessfull installed simpleaudio using: pip3 install simpleaudio.

However, when I tried to use simpleaudio in my project with import simpleaudio as sa, it gives me this error:

Traceback (most recent call last): File "d:\coding\python\python projects\random tests\soundtest.py", line 1, in import simpleaudio as sa ModuleNotFoundError: No module named 'simpleaudio'

Any idea what is wrong?

3

There are 3 best solutions below

0
Daniel Giger On

After I installed simpleaudio, import simpleaudio as sa worked with no errors. I've run into similar errors before, and it was always because the version of pip I was using and the Python interpreter I was using didn't match. You probably need to either switch to using the same interpreter as pip3 or install the package for whatever interpreter you're using

0
Jackson On

The most probable issue is the use of differing version of python. For instance if you use pip3 it is for python3 only

Since the module was not found try

pip install simpleaudio

and then importing again

0
markemus On

It's possible you installed the library for python2 instead of python3. In ubuntu pip is python2 and pip3 is python3- I'm not sure if that's the case on windows or not.