Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

In installed python-virtualenv, because this question said I should use virtualenv to install pygame. However, I'm not really sure how that's accomplished.

What I did (following these instructions):

virtualenv --no-site-packages --distribute -p /usr/bin/python3.3 ~/.virtualenvs/pywork3 --no-pip

And then I don't know where to go.

How do I install pygame to be used in the virtualenv?

Edit: I followed GuySoft's instructions, and everything installed great. However, when I tried import pygame in python3, I got the following error:

>>> import pygame
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alden/.virtualenvs/pywork3/lib/python3.3/site-packages/pygame/__init__.py", line 95, in <module>
from pygame.base import *
ImportError: /home/alden/.virtualenvs/pywork3/lib/python3.3/site-packages/pygame/base.cpython-33m.so: undefined symbol: PyCObject_Check
share|improve this question
1  
src/pygame.h:75:20: fatal error: Python.h: No such file or directory You probably need the Python development files. –  Timo May 25 '13 at 19:22
    
Yeah, right at the beginning of the log I failed to notice that it warned about missing dependencies (including python3.3-dev), so I found the list on the pygame wiki and am installing them right now. –  DaimyoKirby May 25 '13 at 19:27
    
@Timo I installed all the recommended dependencies, but I'm still missing the jpeg dependency. Do you know what this would be? –  DaimyoKirby May 25 '13 at 20:36
add comment

1 Answer

up vote 7 down vote accepted

I suggest you have pip in your virualenv, its useful.

Note: must have pygame's dependencies installed, you can find out what they are and install them with:

sudo apt-get build-dep python-pygame

Then try this:

rm -rf ~/.virtualenvs/pywork3 #clean what you have there
mkdir -p ~/.virtualenvs/pywork3
virtualenv --no-site-packages --distribute -p /usr/bin/python3.3 ~/.virtualenvs/pywork3
. ~/.virtualenvs/pywork3/bin/activate
pip install pygame
share|improve this answer
    
Just added an important step, tested and this should work :) –  GuySoft May 25 '13 at 22:01
    
After I added the Source code repository, everything installed just fine; however, I ran into another error when I tried to import pygame, which I've added to the OP. –  DaimyoKirby May 27 '13 at 21:53
    
That's a different issue. Pygame on python 3 is experiential. Try following these instructions (aka download from source the latest version, and confirm you indeed have all the requirements). –  GuySoft May 30 '13 at 16:32
    
Ok, will check that out. I also contacted the writer of the book to ask him about it. Thanks for the help! –  DaimyoKirby May 30 '13 at 22:31
add comment

Your Answer

 
discard

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.