J'ai écrit les codes suivants dans le fichier d'installation et inclure à la fois sdl_ttf.dll "," SDL.dll dans le dossier par défaut. Mais, il affiche un message d'erreur:NotImplementedError: module de police non disponible
NotImplementedError:font module not available
<Import error: DLL load failed:can't find assigned module>
Le code
from distutils.core import setup
import py2exe,sys,os
import pygame
setup(console=['blackjack.py'])
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in ["sdl_ttf.dll", "SDL.dll"]:
return 0
return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL
pygamedir = os.path.split(pygame.base.__file__)[0]
os.path.join(pygamedir, pygame.font.get_default_font()),
os.path.join(pygamedir, 'SDL.dll'),
os.path.join(pygamedir, 'SDL_ttf.dll')
Y at-il quelque chose de mal?