How can I make Pygame work with Pydev?

14,566

I work with Eclipse on Windows, but I believe that the Mac version eclipse should be the same. In Eclipse,

  • click Windows > Preferences,
  • expand PyDev from left side,
  • find Interpreter - Python,
  • switch to Libraries tab,
  • click New Folder on the right hand,
  • navigate to your pygame path, and
  • click Apply and OK.

Turn to your Python project in eclipse,

  • right click on it,
  • choose PyDev - Interpreter/Grammar,
  • choose Python as Project type,
  • choose 3.0 or your correspond Python version from Grammar,
  • at last make sure the Interpreter you are using is the same as the one you just configured.

Build your project from eclipse, and it should work.

Share:
14,566
Catherine Hwang
Author by

Catherine Hwang

Updated on June 25, 2022

Comments

  • Catherine Hwang
    Catherine Hwang almost 2 years

    I'm working off the latest Mac OS trying to set up my programming environment. Right now what I want to do is to get Pygame working with Pydev so I can do my Python programming from Eclipse. What I've done so far is installed Python 2.6 from python.org and then installed pygame 1.9 from the site.

    What happens is that when I try running Python from the command line, I am able to import pygame without a hitch, but when I try to do the same thing from Eclipse, it doesn't work.

    I think it might be because Pydev doesn't know where to find Python, in which case I would like some help on how to make sure it's pointing to the right one.

    Thanks!

  • Catherine Hwang
    Catherine Hwang over 13 years
    Yeah, I did try "auto-config". Normal Python projects work fine. It's just that for some reason the interpreter that Eclipse is automatically detecting doesn't have the pygame module.
  • Travis
    Travis over 13 years
    Hmm, well sorry to waste your time then. I wonder if there is a conflict between pygame and different versions of python on your system. You may try this link - wiki.laptop.org/go/Pygame/Mac_setup_instructions and try what they say. It looks like it would use python 2.4 and they have a link to the correct pygame for that version of python.
  • Sebastian
    Sebastian almost 12 years
    See this thread about it. That solved my problem too.