如何在ubuntu 14.04中安装pygame和livewires
这个主题不仅涉及pygame,还涉及livewires。 我按照这个链接的第一个答案但是当我写这个命令时: sudo pip install pygame
,我得到一个错误说:
Could not find any downloads that satisfy the requirement pygame. Some externally hosted files were ignored (use --allow-external pygame to allow). Cleaning up... No distributions at all found for pygame Storing debug log for failure in /home/cooldudeabhi/.pip/pip.log
如何解决它们。 另外,我使用的是python 3.4 。 请帮我安装两个模块:Pygame以及livewires。
打开终端并键入以下命令。 它会在你的系统上安装pygame
:
sudo apt-get install mercurial python3-pip libfreetype6-dev sudo apt-get build-dep python-pygame sudo pip3 install hg+http://bitbucket.org/pygame/pygame
关于livewires
,似乎这个包只适用于python2.x,因为我在运行sudo pip3 install livewires
时出现以下错误:
Running setup.py install for livewires File "/usr/local/lib/python3.4/dist-packages/livewires/beginners.py", line 201 raise ExBadParameters, "colour must be from Colour class" ^ SyntaxError: invalid syntax File "/usr/local/lib/python3.4/dist-packages/livewires/boards.py", line 239 if k <> l and k <> -l: ^ SyntaxError: invalid syntax File "/usr/local/lib/python3.4/dist-packages/livewires/games.py", line 110 raise GamesError, "Cannot have more than on Screen object" ^ SyntaxError: invalid syntax
当你想用python3解释器运行python2代码时,这种错误非常频繁。
更新 :似乎可以在上述文件上运行2to3并成功安装livewires
。
- 从pypi下载并提取LiveWires-2.1.tar.gz 。
-
cd LiveWires-2.1
-
2to3 -w livewires/*
-
sudo python3 setup.py install
有一个Ubuntu包python-pygame
。 您可以使用图形应用程序软件或命令行安装它
sudo apt-get install python-pygame