如何安装pygame字体

1 投票
1 回答
3535 浏览
提问于 2025-04-16 13:24

这是一个初学者的问题。我在Ubuntu 10.10上自学pygame。我下载了一些示例代码,但pygame运行得不太对。我怀疑是安装出了问题,但我不太确定该怎么查找。

我还需要安装其他什么东西才能让它正常工作吗?

  1. 我的示例代码: http://cid-bb9549bdfdec74f4.skydrive.live.com/self.aspx/PyPlotter/pyplotter.py

  2. 我遇到的错误:

    提示:python pyplotter.py

    pyplotter.py:27: 运行时警告:使用字体时出错:没有名为font的模块

    (导入错误:没有名为font的模块)

    font = pygame.font.SysFont("arial",12)

追踪(最近的调用在最后):

文件 "pyplotter.py",第27行,在 <模块>

font = pygame.font.SysFont("arial",12)

文件 "/usr/local/lib/python2.6/dist-packages/pygame-1.9.1release-py2.6-linux-i686.egg/pygame/__init__.py",

第70行,在 getattr 抛出 NotImplementedError(缺少Pygame模块)` NotImplementedError: 字体模块不可用 (导入错误:没有名为font的模块)

3. 我是用以下命令安装pygame的:sudo easy_install pygame

This says I have the latest version of pygame.  So, Do i need to install
something different for fonts?

1 个回答

4

与其通过 easy_install 来安装,不如直接安装 Ubuntu 的 pygame 软件包:python-pygame(它在 universe 这个分类里)。

撰写回答