Virtually nothing manages to install either through pip or other supposedly convenient ways.

It is worth virtualenv in Ubuntu 14.04, created in it an environment on Python 3.4.

Now it's been 2 hours trying to put pygame. From the heap of methods, it is more or less obtained with

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 

To check, I created a Python file with the line from pygame import * , when I launch it from a virtual environment, the `ImportError: No module named 'pygame' swears. If you run not from the environment, it runs without errors.

What am I doing wrong?

    1 answer 1

    On Ubuntu 14.04, there is no official python3-pygame package, so the next step is to use PPA, for example, ppa:thopiekar/pygame , recommended at AskUbuntu: How can I get pygame for Python3?

     $ sudo apt-get install -y software-properties-common && # для add-apt-repository sudo add-apt-repository -y ppa:thopiekar/pygame && # где взять python3-pygame sudo apt-get update -y && # обновляем список пакетов sudo apt-get install -y python3-pygame # ставим 

    After that, the python3 -c 'import pygame' command should work.

    Caution: PPA may contain anything that their authors want - put at your own risk.


    If it does not work from a virtual environment, but does not work in an environment, then either the environment is created for another version of Python or the system packages are not included when creating virtualenv ( --system-site-packages option) --system-site-packages environment again.

    • Thank. Created a new environment. In the process of creating, I remembered that the previous environment created without the --system-site-packages key. Now I’ll try to put the remaining half-day livewires - Igor Che
    • Put and livewires. Installed from the downloaded package manually, but again, not the first time. We must now do the same thing on another 2 computers, maybe find a pattern of glitches. - Igor Che