How to install pygame and livewires in ubuntu 14.04

9,378

Solution 1

Open a terminal and type the following commands. It will install pygame on your system:

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

Regarding livewires, it seems that this package is for python2.x only as I got the following error when running 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

Such errors are quite frequent when you want to run python2 code with a python3 interpreter.


Update: it seems possible to run 2to3 on the above files and successfully install livewires.

  1. Download and extract LiveWires-2.1.tar.gz from pypi.
  2. cd LiveWires-2.1
  3. 2to3 -w livewires/*
  4. sudo python3 setup.py install

Solution 2

There is an Ubuntu package python-pygame. You can install it using the graphical application Software or on command line by

sudo apt-get install python-pygame
Share:
9,378

Related videos on Youtube

Everything123 Channel
Author by

Everything123 Channel

I am just some random shitty coder trying to improve. Teach me daddy!

Updated on September 18, 2022

Comments

  • Everything123 Channel
    Everything123 Channel over 1 year

    This thread is not only about pygame but also about livewires. I followed the first answer on this link but when i write this command : sudo pip install pygame, I get an error saying:

    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
    

    How to fix them. Also, I am using python 3.4. Please help me to install both modules: Pygame as well as livewires.

    • muru
      muru about 9 years
      If your using python3, you should be using pip3 instead of pip.
  • muru
    muru about 9 years
    It's for Python2 only.
  • Everything123 Channel
    Everything123 Channel about 9 years
    I am using livewires with python 3.1 on my windows machine
  • Sylvain Pineau
    Sylvain Pineau about 9 years
    @androidplusios.design: version 2.1 from pypi? please post your installation steps as a new answer if possible
  • Everything123 Channel
    Everything123 Channel about 9 years
    For windows machine?
  • Sylvain Pineau
    Sylvain Pineau about 9 years
    @androidplusios.design: Probably not ;). But I’m still curious about the python3.x compatibility.
  • Everything123 Channel
    Everything123 Channel about 9 years
    Download the complete pack from here...instruction inside of the files. bit.ly/1wmJ3mA
  • Sylvain Pineau
    Sylvain Pineau about 9 years
    @androidplusios.design: Thanks for the link. The livewires version is 1.7 according to the games.py header.