I’m facing a ModuleNotFoundError when trying to import the playsound library in my Python script, even though the library is installed in my virtual environment.
“I initially tested the playsound
library outside of the virtual environment, where it worked successfully with both versions 1.2.2 and 1.3.0. However, when I switched to the virtual environment, I consistently encountered the error: No module named 'playsound'
.
To resolve the issue, I attempted various troubleshooting methods such as removing and reinstalling the library, switching between different versions of the library, and experimenting with different import statements. I also attempted to locate the playsound
library in the Lib/site-packages
directory, but it was not present there.
Despite these efforts, when I run pip list
, the playsound
library appears as installed. Yet, when I execute my script, I continue to encounter the error: No module named 'playsound'
.
Here is my code:
from playsound import playsound
# # Play assistant sound
# def playAssistantSound():
playsound("www\assets\audio\start_sound.mp3")
Дани Българин is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.