Reputation: 79
music = pygame.mixer.music.load('not.mp3')
pygame.mixer.music.play(loops=-1)
when executing the code I got this error:
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\Escape it!.py", line 15, in <module>
music = pygame.mixer.music.load('not.mp3')
pygame.error: Failed loading libmpg123.dll: Attempt to access invalid address.
I have tried everything from giving full path to only the name but everytime this shows up
Upvotes: 7
Views: 21269
Reputation: 15
Had the same issue. Surely enough just restarting my IDE or computer didn't help as well as copypasting libmpg123.dll
to Windows directories or simply reinstalling pip/pygame
.
I was using Python 3.9 from Microsoft Store. Before giving up and reinstalling Python from Python.org, I downloaded pygame‑2.1.2‑cp39‑cp39‑win_amd64.whl
and then run:
pip install pygame-2.1.2-pp38-pypy38_pp73-win_amd64.whl
This worked perfectly well for me without python reinstallation.
Upvotes: 0
Reputation: 1
I got this error message because I used the version of Python that was installed from the Windows Store. I reinstalled from official Python and the error went away.
Upvotes: 0
Reputation: 1
1.Go to the directory where pygame is installed (you can get it by typing pip install pygame).
2.Look for the libmpg123.dll in pygame directory.
3.Copy and paste to C:/windows/system3 and C:/windows/sysWOW64.
Upvotes: 0
Reputation: 1
pip install pygame
).libmpg123.dll
in pygame directory.C:/windows/system3
and C:/windows/sysWOW64
.Upvotes: 0
Reputation: 11
All the options given above didn't work for me. So, i uninstalled and reinstalled the "pygame" library from this site. https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame. which worked well.
Upvotes: 1
Reputation: 1210
When you newly install the pygame
, it require system restart.
Just Restart your PC/Laptop
and then Run the code, it will not throw any error.
The answer of @jrsylvester right, but there is some questions.
Answer : When you newly installed the pygame
and execute your code, then it will throw an error.
The system require a reboot to setup their file or code for working environment. so restart your PC/Laptop.
Happy Coding..!
Upvotes: 0
Reputation: 11
Doing following steps maybe solve the problem:
Step 1: Go to browser and search download libmpg123.dll
.
Step 2: download libmpg123.dll
and Extract it.
Step 3: After Extract (cut or copy) the two docs and paste in "C:\Windows\System32".
Step 4: Installation successfully done.
And this is also works :-
music = pygame.mixer.music.load('not.mp3')
pygame.mixer.music.play(loops=-1)
Thanks You
Upvotes: 1
Reputation: 1
I was under the same problem what i did was simply Install another IDE or just try reinstalling pygame.
Upvotes: -2
Reputation: 19
Restart your IDE if that doesn't work try restarting your PC it worked for me!!
Upvotes: 1
Reputation: 19
Just close whatever IDE you are using and restart the system. It worked for me!
Upvotes: 1