Running Python 2.7.2, and Pygame 1.9.2pre on OS X.
Another noobious issue: Initialising the pygame.font module produces an error that I dare not... well, attempt to solve myself. I'm guessing this is a rather generic pygame-related issue... but I haven't been able to find any solutions.
import pygame
pygame.init()
pygame.font.init()
Gives:
Desktop/font.py:4: RuntimeWarning: use font: dlopen(/Library/Python/2.7/site-packages/pygame/font.so, 2): Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /Library/Frameworks/SDL_ttf.framework/Versions/A/SDL_ttf
Reason: image not found
(ImportError: dlopen(/Library/Python/2.7/site-packages/pygame/font.so, 2): Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /Library/Frameworks/SDL_ttf.framework/Versions/A/SDL_ttf
Reason: image not found)
pygame.font.init()
Traceback (most recent call last):
File "Desktop/font.py", line 4, in <module>
pygame.font.init()
File "/Library/Python/2.7/site-packages/pygame/__init__.py", line 70, in __getattr__
raise NotImplementedError(MissingPygameModule)
NotImplementedError: font module not available
(ImportError: dlopen(/Library/Python/2.7/site-packages/pygame/font.so, 2): Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /Library/Frameworks/SDL_ttf.framework/Versions/A/SDL_ttf
Reason: image not found)
What exactly is wrong here and how to resolve it?
I am using 64 bit version of Python with 32 bit Pygame (there seems to be no 64 bit Pygame available for Mac OS).
I encounter the same problem, and the making-this-problem progress is as follow:
pygame
source file from the http://www.pygame.org/pygame
with command python setup.py install
Then, I can import pygame
and use basic pygame functions normally, but if I try to import other relative modules like import pygame.font
, it jumps out font module not found
error. I try to fix this problem by install some missing modules manually as suggested here:
$ sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev
libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion
libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev
However, this problem still exists.
At last, I realize this is a dependency problem, so I remove installed pygame by the command sudo python setup.py clean
and remove all files in python/site-packages
. I reinstall the pygame
by the command:
sudo apt-get install python-pygame
and everything works fine.
Problem: Using 32-bit Pygame with 64-bit Python generally isn't a good idea.
Solution: Always use Python and Pygame both in 64-bit architecture. (Or 32).
Currently there doesn't seem to be a 64-bit Pygame for OS X, so you'll have to use a 32-bit Python.
After installing a 32-bit Python you may need to re-install the 32-bit Pygame for it to have any effect. This is what happened to me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With