2

I would like to use PyGame with the latest version of Python 2, on my Mac (running OS X 10.9.5). My understanding is that to do this, I need to install a 32-bit version of Python.

I went to Python.org, followed the Mac links and downloaded and installed the 32-bit version of Python 2.7.12. Everything worked fine.

Then, I went to http://pygame.org/download.shtml , and found pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg and installed that. The installation seemed to work fine.

To test it, I opened IDLE, and tried this:

import pygame

rather than importing cleanly, I get the following traceback:

Traceback (most recent call last):
  File "<pyshell#0>", line 0, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
    from pygame.base import *
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/pygame/__init__.py", line 103, in <module>
    Color = color.Color   #error on this line
NameError: name 'color' is not defined

I have developed Python with PyGame programs for years with an earlier version of Python - but I needed to update to the latest version of Python. But now, I cannot run any of my PyGame-based code because of this error. (I've tried these steps multiple times, always resulting in the same error.)

Can anyone help me figure out how to get PyGame installed correctly so I can continue development?

Ideally, is there a series of steps that works correctly WITHOUT having to enter any commands at a command line? I need to be able to instruct new programmers how to get this environment set up, and they have zero experience doing anything at the command line.

furas
  • 134,197
  • 12
  • 106
  • 148
Irv Kalb
  • 319
  • 3
  • 4
  • check this file which makes problem, repair it and send message to PyGame author . If you have problem with "commands" and "new programmers" then create script so they have to only run one command. – furas Nov 15 '16 at 04:40
  • did you try to install with `pip` - maybe they create newer version. This summer they created newer version for Linux which is available only with `pip`. – furas Nov 15 '16 at 04:46
  • @furas Thanks. I have looked but cannot find the PyGame author. If you have any email contacts, please let me know. I would be OK with creating a script, but I don't know what I would put in the script to make this work. I have looked at the source file, but I don't know what is wrong with it. But I don't want to be editing the PyGame source files, I just want to use it. I did try to install with pip, and got this result: Requirement already satisfied: pygame in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages No change. I still get the same error. – Irv Kalb Nov 15 '16 at 05:33
  • try to update - `pip install --update pygame` (or shorter with upper `U`: `pip install -U pygame`). Pygame.org page belongs to python author - maybe you can find him on this page. I saw him and pygame issues on pygame repo in bitbucket.com – furas Nov 15 '16 at 05:40
  • did you try to install with `brew` ? I see on SO questions like this http://stackoverflow.com/questions/33305399/installing-pygame-with-homebrew – furas Nov 15 '16 at 05:42
  • Pygame author: René Dudfield - and his instruction how to install Pygame with brew: https://bitbucket.org/pygame/pygame/issues/82/homebrew-on-leopard-fails-to-install#comment-627494 (I found this link on your link http://pygame.org/download.shtml :) ) – furas Nov 15 '16 at 05:45
  • OK, I figured it out and fixed it. It was user error. Apparently, in one of my attempts to get the environment set up, I had mistakenly downloaded and installed the wrong version of PyGame - so, in my site- packages folder I had two copies of PyGame. The wrong one got loaded. I cleared out both, re-installed the proper one, and I'm up and running! Sorry for the fire drill. – Irv Kalb Nov 16 '16 at 05:15

0 Answers0