0

Doing this on a mac. I've installed the package from the website but when I run a script with import pygame it says it doesn't exist. Looked online and it says I need to run the configure.py file but I can't seem to locate that file. Any tips?

Here is my code so far:

import pygame  
screen = pygame.display.set_mode((640, 480)) 
running = 1  
while running:
     event = pygame.event.poll()
     if event.type == pygame.QUIT:
         running = 0
     screen.fill((0, 0, 0))
     pygame.draw.line(screen, (0, 0, 255), (0, 0), (639, 479))
     pygame.draw.aaline(screen, (0, 0, 255), (639, 0), (0, 479))
     pygame.display.flip()
Rex Nihilo
  • 604
  • 2
  • 7
  • 16
  • Did you try installing via `pip` or `easy_install`? – wkl Nov 25 '11 at 03:01
  • Assuming you're using the system installed version of python, open a terminal and type in `easy_install Pygame`. – wkl Nov 25 '11 at 03:10
  • Hmm still doesn't seem to work. Here's my script: `import pygame screen = pygame.display.set_mode((640, 480)) running = 1 while running: event = pygame.event.poll() if event.type == pygame.QUIT: running = 0 screen.fill((0, 0, 0)) pygame.draw.line(screen, (0, 0, 255), (0, 0), (639, 479)) pygame.draw.aaline(screen, (0, 0, 255), (639, 0), (0, 479)) pygame.display.flip()` –  Nov 25 '11 at 03:19
  • I don't know how to make this neater. –  Nov 25 '11 at 03:22
  • 3
    Edit your original question to show what you've done so far to get Pygame to install. And do it in a hurry -- you're pretty close to getting your question closed as I don't believe other people think this is a good question. –  Nov 25 '11 at 06:26
  • 2
    Hello SO neighbors, if you don't like a question: close it, but don't migrate them to us. kthxbye – Ivo Flipse Nov 25 '11 at 08:25
  • @user1064913 to make in neater - edit the question - however we want to know how you tried to install not what your code is – mmmmmm Nov 25 '11 at 12:45

1 Answers1

0

The script is probably using a version of python that you did not install pygame into.

I believe the pygame binary installer (which is what I assume you meant by "package from the website") installs into system python. Check which version you are using by default. This is what it should look like when you run "which python" from Terminal.app:

$ which python
/usr/bin/python

This happens all the time if you use MacPorts, Fink, or a Python.org binary installer to install python. If you are using MacPorts or Fink, python may have even been installed without your knowledge as a dependency to something else.

Nathan Stocks
  • 2,096
  • 3
  • 20
  • 31