Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been using Python on Windows for a while, so I'm into a lot of modules, including Pygame and LiveWires, but how do I install them into Ubuntu?

I have the py file for LiveWires, which has been specially edited (from a book I'm reading). I want to install it, but I'm not sure how to. I also want to install Pygame, but I can't.

share|improve this question

In Ubuntu, you can list the packages available with the command

apt-cache pkgnames

but its output is huge, so pipe it to grep and search for what you want, (and then pipe to sort doesn't hurt either).

apt-cache pkgnames | grep py | sort

From this, looks like you want the python-pygame package, so install it with:

sudo apt-get install python-pygame
share|improve this answer

Before doing anything I recommend you install virtualenv and virtualenvwrapper. These make it easy to create isolated Python environments for any project you start. This comes in really handy if ever you break anything because it's isolated to one project.

Install Python modules inside a virtualenv is as easy as running:

pip install Pygame

from a terminal. pip will also keep track of what packages are in each of your environments, making it easy to upgrade or uninstall them when needed. Although I don't work on Windows so can't confirm, I believe this solution is also cross-platform.

share|improve this answer
I'm studying Python and Linux for the LPI cert right now. How could you break something so bad that it affects the rest of the system, if you're just working on one python project in set directory? When I'm on the desktop, would I be at this risk if I'm using an IDE like say, Ninja IDE? – Alex Sep 27 '13 at 20:23
Sorry I was unclear. There's no risk from using an IDE. The problem virtualenv solves is making sure you don't load lots of unrelated modules for different projects into the system-wide Python interpreter. Using project-specific Python interpreters means each one only ever has what it needs so you reduce the risk of a conflict. – Garry Cairns Sep 29 '13 at 13:12
That's very informative, thank you! Since you mention that, I will continue to just use my IDE then, since it's more stable than gedit. Then I don't have to worry about the modules glitch. – Alex Sep 30 '13 at 1:54

Do this:

$ sudo apt-get install python-pygame

In general, if you want some on Linux, you search a corresponding package by

$ apt-cache search <python-module>

and install an appropriate package by apt-get install like above.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.