[Python] Font module not available error in Pygame

Discussão em 'Python' iniciado por Stack, Abril 3, 2025.

  1. Stack

    Stack Membro Participativo

    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).

    Continue reading...

Compartilhe esta Página