0

I have a file, named L1_base.py, from my instructor with the base code that I am supposed to run. But every time I type, "python L1_base.py" into the command prompt, I get this error message:

Traceback (most recent call last):
  File "L1_base.py", line 3, in <module>
    import sys, pygame
  File "/home/akeen/public/pygame/lib/python3.3/site-packages/pygame/__init__.py", line 127, in <module>
    from pygame.base import *
ImportError: No module named base

I've tried re-downloading the files given to me by my instructor and I've tried re-installing python, but this message keeps coming up. I've also done a quick "hello world!" tutorial; and when I try running that code, everything's fine.

I am using a Macbook Pro (Software: OS X, 10.9.2) and more specifically, I am referring to python 3.

I looked at the provided base code and I noticed that it's importing pygame; is this happening because I need to install pygame?

Thanks for any help in advance!

1 Answers1

2

Pygame isn't part of the std library of Python, so you cannot import it directly.

Use: apt-get install python-pygame or any installer to install it. You can also manually download the files and install it, too.

You can also use pip, which is what I do.

Here's a nice post to check out if you have trouble: Unable to install Pygame using pip

Community
  • 1
  • 1