ModuleNotFoundError: No module named 'playsound' | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

ModuleNotFoundError: No module named 'playsound'

I KNOW this question has been "answered" several times, but I'm going to ask it again after running through the steps.... I. I went and ran pip install playsound on my computer. command prompt tells me "Requirement already satisfied", and shows me the dirrectory leading to site-packages (1.2.2) II. I try typing my code in IDLE..... from playsound import playsound def Song(): playsound('D:/Documents/Python/Evermore/Evermore.mp3') Song() III. BUUUUT I get the following error.... Traceback (most recent call last): File "D:\Documents\Python\Evermore\Evermore.py", line 1, in <module> from playsound import playsound ModuleNotFoundError: No module named 'playsound' this means if I'm correct that no such module for playsound exists, EVEN THOUGH I ALREADY INSTALLED IT WITH PIP!!! IV. I find that it might be the wrong version, so I go back to terminal and try the following command 'pip3 install playsound' BUT it keeps telling me that pip3 is not recognized V. I restart terminal and type in python, and I get Python 3.7.4 as the version installed, which SHOULD tell me that the version I'm working with is a version of python 3. I type 4+4 and the return is 8 so I know that it's working as it should. VI. I restart terminal, and type in pip3 install playsound.... still the same error.... I just can't seem to get python to recognize that I want to play an mp3 file. I have the file in the same directory as the script so it SHOULD recognize that that's the file to be played, but when I try removing the directory from the name. I tried removing, changing the slashes in the path, NOTHING What AM I doing wrong with something as simple as this?

19th Feb 2021, 5:52 PM
William Weidner
William Weidner - avatar
2 Respuestas
0
I deduce that you are on linux, if you have python3 installed download get-pip.py script at https://bootstrap.pypa.io/get-pip.py, then do "python3 get-pip.py" to install pip3. After this you should be able to do "pip3 install playsound".
19th Feb 2021, 6:26 PM
OrHy3
OrHy3 - avatar
0
I don’t know how you can even run pip on its own from the command line, but what operating system are you using? When I install python packages on windows 10, this is how I do it: python -m pip install pygame (you can use pygame.mixer to play sounds). if you have multiple versions of python installed on windows, things could be a little more conplicated. make sure that the command line python you are using is the same version that is launching IDLE.
19th Feb 2021, 6:27 PM
Wilbur Jaywright
Wilbur Jaywright - avatar