installing python with idle & pygame

Discussion in 'Mac Programming' started by raylang, Jan 4, 2014.

  1. raylang macrumors newbie

    Joined:
    Jan 4, 2014
    #1
    Running OSX 10.9.1 on a Mac mini. I used Python 2.7.6 Mac OS X 64-bit/32-bit x86-64/i386 Installer, downloaded from http://www.python.org/download/, to install python with idle. I ran the Update Shell Profile.command in the Python 2.7 folder. Idle gives a warning on startup:

    >>> WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.
    Visit http://www.python.org/download/mac/tcltk/ for current information.

    According to that, I needed Tcl/Tk 8.5.15 or later (I have no experience with that package) I downloaded ActiveTcl8.6.1.1.297588-macosx10.5-i386-x86_64-threaded from ActiveState, but Idle gives the same error on startup.

    My goal is to learn python and pygame. I have successfully installed:

    pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3

    I'm not a new programmer, but I am new to python and inexperienced at Mac installs that go beyond double-clicking a single install file or dragging an icon into a folder (in other words, I haven't done anything like a build from the command line), but evidently I'm missing a step here. I'm also new to these forums and appreciate any suggestions. Thanks for your patience with these newbie questions.
     
  2. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #2
  3. edwardIn macrumors newbie

    Joined:
    Aug 6, 2011
    #3
    Similar Python question

    I have a similar question about Python and Pygame. I downloaded and installed pygame, but when I run a script which includes "import pygame", I get an ImportError saying "No module named 'pygame.'"

    I'm running Python 3.3. I noticed on my hard drive I have a folder named 'Python.' In it are sub-folders named 2.3, 2.5, 2.6, and 2.7. The 2.7 folder has a folder named 'site-packages.' It has a 'pygame' folder in it. I wonder if the Python 3.3 I run does not look at the 2.7 folder for modules?

    Thank you for any assistance.

    Ed
     
  4. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    Python 2 and 3 are incompatible with each other. You'll need to either use Python 2.7.6 to use your installed copy of PyGame, or find a version of PyGame for Python 3. I'm not sure what the end of life plan for Python 2 is, but I think they might be ending support for it before the end of 2014... Might cause problems, given a lot of the modules I use regularly haven't been updated for Python 3 yet...
     
  5. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #5
    PyGame is obsolete now - PySDL2 is the recommended replacement. Note that you'll need to download SDL2, SDL2_image, SDL2_mixer, and SDL2_ttf separately - unlike Pygame, which bundles SDL.
     
  6. raylang thread starter macrumors newbie

    Joined:
    Jan 4, 2014
    #6
    Hi -- thanks for the reply. It did help, I'd seen the page earlier, but I grabbed ActiveTcl 8.6 instead of ActiveTcl 8.5.15.0, as instructed, thinking a later version would be fine. I now successfully have both Python 2.7.6 and 3.3.3 installed, both with Idle. Now, pygame 1.9.1 fails to import in either. It's supposed to be the version for Python 2.7.6, according to the download page, but it gives the following error:

    Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
    Type "copyright", "credits" or "license()" for more information.
    >>> import pygame

    Traceback (most recent call last):
    File "<pyshell#0>", line 1, in <module>
    import pygame
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
    from pygame.base import *
    ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find:
    /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper

    As best I can interpret that, it means pygame is not installed correctly or completely. (to wrldwzrd89, for the moment, I need to move forward with pygame, but I certainly appreciate the notice that it's being replaced by pySDL2)

    In Python 3.3, I only get "ImportError: No module named 'pygame'"

    I tried the instructions shown on:

    http://florian-berger.de/en/articles/installing-pygame-for-python-3-on-os-x

    but I got stuck on the 3rd-to-last step (damn!):
    /usr/local/share/python3/easy_install pip

    'easy_install' was not found, nor could I locate it in the file system.

    Thanks again for the help, and any more suggestions are welcome.

    --Ray
     
  7. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #7
    I believe your problem in Python 2.7.6 is that you're running Python in 64 bit mode but only have a 32 bit version of PyGame. Or maybe it's the other way around. That's what having the wrong architecture would indicate to me.

    It's not going to work in Python 3. Period. Read my earlier post in this thread for more details if you don't understand.
     

Share This Page