简体   繁体   English

ubuntu ImportError上的pygame:没有名为font的模块

[英]pygame on ubuntu ImportError: No module named font

I'm running Python 2.7.11 on Ubuntu 14.04 我在Ubuntu 14.04上运行Python 2.7.11

I was trying to run https://github.com/asrivat1/DeepLearningVideoGames and teach my computer to play pong, but I'm stuck at a pygame error that I can't seem to find a solution to. 我试图运行https://github.com/asrivat1/DeepLearningVideoGames并教我的电脑打乒乓球,但我陷入了pygame错误的困扰,似乎找不到解决方法。

When running deep_q_network.py I get the following error: 运行deep_q_network.py ,出现以下错误:

Wrapped Game Code/pong_fun.py:31: RuntimeWarning: use font: No module named font
(ImportError: No module named font)
 font = pygame.font.SysFont("calibri",40)
Traceback (most recent call last):
 File "deep_q_network.py", line 7, in <module>
  import pong_fun # whichever is imported "as game" will be used
 File "Wrapped Game Code/pong_fun.py", line 31, in <module>
  font = pygame.font.SysFont("calibri",40)
 File "/home/me/anaconda2/lib/python2.7/site-packages/pygame/__init__.py", line 70, in __getattr__
  raise NotImplementedError(MissingPygameModule)
NotImplementedError: font module not available
(ImportError: No module named font)

I installed pygame using conda install -c https://conda.anaconda.org/tlatorre pygame . 我安装pygame使用conda install -c https://conda.anaconda.org/tlatorre pygame

Instead of installing through conda install, install the Ubuntu package for pygame: python-pygame, it's in universe. 无需通过conda install进行安装,而是为pygame安装Ubuntu软件包:python-pygame,它位于Universe中。

Like this 像这样

xyzUbuntu:~$ sudo apt-get install python-pygame

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM