Jim
Jim

Reputation: 521

Installing pygame

I'm completely new to Python. I used Macports to install Python, as per advice that the pre-installed version of Python is not ideal on OSX.

I also ran the Pygame installer for OSX.

When I go into the Python console and type:

import pygame
pygame.init()

it works fine (i.e., returns (0,6)) if I'm in my root directory.

If I try this elsewhere, I get the error:

File "< stdin >", line 1, in <module>
AttributeError: 'module' object has no attribute 'init'

What am I doing wrong?

Upvotes: 0

Views: 462

Answers (2)

Jared Smith
Jared Smith

Reputation: 21926

To use pygame on OS X make sure you are running it in 32bit mode.

arch -i386 /Library/Frameworks/Python.framework/Versions/2.7/bin/idle2.7 -n

is an example of a terminal command to start idle in 32bit mode to run pygame code.

Upvotes: 0

rve
rve

Reputation: 43

I have install python 2.5, 2.6, 2.7 with homebrew on my OSX, and first attempt also failed. I thought it may be pygame'fault. Just try another mkpg/src http://pygame.org/ftp/

Upvotes: 1

Related Questions