Problems Getting Pygame To Show Anything But A Blank Screen On Macos
Solution 1:
Tested and works on macOS 10.15 Catalina
, Python 3.7.5
, PyGame 2.0.0
(pre-release as of this writing) and PyGame 1.9.6
(stable as of this writing).
Initially you need to decide if you want a stable release or a pre-release (unstable). If you decide to use the latest (and possibly pre-release/unstable) then just ignore the first step ("1. Find the latest stable release version") and use master
branch at step 4 of the second step ("2. Install PyGame from source").
1. Find the latest stable release version
Go to PyGame's GitHub page here:
As you can see as of this writing the latest stable release is 1.9.6
so we hold this tag name for later.
2. Install PyGame on macOS from source
- Install some dependencies
brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_net sdl2_ttf
. This requires homebrew. - Go to
site-packages
:- For virtual environment go to
cd ~/.virtualenvs/myvirtualenv/lib/python3.X/site-packages
where~/.virtualenvs/myvirtualenv
is the path to your virtual environment andpython3.X
is the version of your Python. - For system-wide installation go to
/usr/local/lib/python3.X/site-packages
wherepython3.X
is the version of your Python.
- For virtual environment go to
- Delete any previous pygame,
pip uninstall pygame
(if apygame
directory exists insite-packages
then remove it:rm -rf pygame*
) - Clone PyGame from GitHub:
git clone https://github.com/pygame/pygame.git
for the latest (possibly not stable version).git clone -b 1.9.6 https://github.com/pygame/pygame.git --single-branch
for the latest (1.9.6
is the tag name of the latest stable release, as of this writing, see "Find the latest stable release version above")
- Go into the newly cloned
pygame
directory:cd pygame
. - Run
python setup.py --config --auto --sdl2
.- If you get problems with this command, some users below mentioned that single hyphens worked for them, therefore try:
python setup.py -config -auto -sdl2
. - If you get any problems regarding Python2/3 and you are targeting Python3 try to change
python setup.py --config --auto --sdl2
topython3 setup.py --config --auto --sdl2
.
- If you get problems with this command, some users below mentioned that single hyphens worked for them, therefore try:
- Run
python setup.py install
(it will take a while).- If you get any problems regarding Python2/3 and you are targeting Python3 try to change
python setup.py --config --auto --sdl2
topython3 setup.py --config --auto --sdl2
.
- If you get any problems regarding Python2/3 and you are targeting Python3 try to change
Now PyGame should work as expected on macOS.
Solution 2:
I also face this problem on the macOS Catalina. Actually it is a version problem of pygame. Firstly I have installed with the following command:
pip3 install pygame
An only blank screen was showing. But later on, I have changed the version with the following command:
pip3 install pygame==2.0.0.dev4
With this version my problem was solved. It was working perfectly.
Solution 3:
LATEST UPDATE for MacOS 10.14.1
If you download the official macOS x64 installer package of Python 3.7.2 from the official python.org page and type pip3 install pygame
, it works.
There's an issue with MacOS. It should be possible to fix in SDL.
- https://discourse.libsdl.org/t/macos-10-14-mojave-issues/25060/8
- https://bugzilla.libsdl.org/show_bug.cgi?id=4274
The pygame issue is here: https://github.com/pygame/pygame/issues/555
The homebrew issue is here: https://github.com/Homebrew/homebrew-core/issues/33016
Solution 4:
I ran into this issue using macOS Catalina version 10.15.2, Python 3.7.2 and pygame 1.9.6. I upgraded to Python 3.8.1, Pygame 2.0.0.dev6 and it is now working as expected.
Solution 5:
I tried upgrading my old macbook to OS Mojave to see if pygame would stop working, and it did!
I guess Mojave isn't compatible with pygame (yet).
Thanks for the help!
Post a Comment for "Problems Getting Pygame To Show Anything But A Blank Screen On Macos"