1

I have been trying to get the pygame module to work with python3 in a macbook 10.6. I read it was tricky, I had to install from source code following these instructions: http://programming.itcarlow.ie/PyGameInstall.pdf Everything went OK, but when I try to import pygame I get this error:

Python 3.2.2 (v3.2.2:137e45f15c0b, Sep  3 2011, 17:28:59) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pygame/__init__.py", line 95, in <module>
    from pygame.base import *
ImportError: dynamic module does not define init function (PyInit_base)

I have no idea what this means. I have done the regular installation and it works fine with python 2.7 but I want some features from python3. Any ideas about what's wrong here?

0

2 Answers 2

2

I found this question because I was faced with the same challenge. I discovered that Python 3.2.x has a bug with pygame package. I wanted Python 3.x with pygame. I uninstalled Python 3.2.3 and reinstalled Python 3.1.4 then installed pygame-1.91.win32-py3.1.msi and it now works for me.

Sign up to request clarification or add additional context in comments.

Comments

1

Python 3.x series is not retro-compatible with 2.x series; thus you need the specific pygame version for Python 3.x (or run it through 2_to_3 script, although I'm not sure it works on C code too..). Why don't you want to use Python 2.7?

3 Comments

I know that, that's why I used those instructions, the're specific on how to make pygame work under python 3.x on a macbook running 10.6. I figured since I was using the source code I did not need a special binary code for mac or for python 3.x. What I don't understand is the last line on the error message.
From the swig doc here swig.org/Doc1.3/Python.html#Python_nn9 it looks like usually it is a .so naming error..
That actually helps a little, but still no .so file naming was up to me during the installation so I still have no idea how to fix this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.