Python 2.7.8 and Pygame

Discussion in 'Mac Programming' started by JonnyAlpha, Nov 27, 2014.

  1. JonnyAlpha macrumors regular

    Joined:
    Oct 30, 2008
    #1
    Hi;

    I am learning Python for my Pi but I'm trying it out on my Mac.

    Python 2.7.8 is installed by default but I also need Pygame, what version of Pygame do I need.
    Can anyone point me to a guide for installing Pygame for Python 2.7.8.

    I hav a Macbook Mid 2008 Mavericks 10.9.5

    Thanks
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    Not sure about Pygame in particular, but the typical rule of thumb for getting anything Python installed is to install pip first, then type

    Code:
    pip install <name>
    IE,

    Code:
    pip install pygame
    In Python 3.2, pip became an official part of Python. It works for older versions too but isn't part of the official install.

    Here's the directions for getting pip:
    https://pip.pypa.io/en/latest/installing.html
     
  3. JonnyAlpha thread starter macrumors regular

    Joined:
    Oct 30, 2008
    #3
    Thanks
    I tried pip previously but got an error, however after posting this I found this very useful guide on Youtube.

    I did spot an error on the install of Pygame dependancies:

    curl: (35) Server aborted the SSL handshake
    Error: Failed to download resource "freetype"
    Download failed: http://softlayer-dal.dl.sourceforge...es/freetype-2.5.3_1.mavericks.bottle.1.tar.gz
    Warning: Bottle installation failed: building from source.


    Should I run it again?

    The guide also gave instructions to download and install Python Idle from the Python site to get an icon for the Dock?? I did this as well but when I enter import pygame at the prompt I get the following error:

    Traceback (most recent call last):
    File "<pyshell#0>", line 1, in <module>
    import pygame
    ImportError: No module named 'pygame'
     
  4. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    ... Why would SoftLayer be involved in the dependencies?
     
  5. JonnyAlpha thread starter macrumors regular

    Joined:
    Oct 30, 2008
    #5
    Cannot Import Pygame

    Hi;

    I am trying to install Python and Pygame, I have installed them by following this guide.

    Not sure why but it also says to install Python from the Python site.

    Anyway now its installed whether I run Python from within the Terminal or from the Idle App when enter 'import pygame' and press return I get the following error:

    import pygame
    Traceback (most recent call last):
    File "<pyshell#0>", line 1, in <module>
    import pygame
    ImportError: No module named 'pygame'


    Any idea how to resolve this?

    Thanks

    P.S. I am very new to Python and Pygame
     
  6. JonnyAlpha thread starter macrumors regular

    Joined:
    Oct 30, 2008
    #6
    Don't know I'm new to all this?
     

Share This Page