1

I am running OS X Lion, Python 2.7, and I am trying to setup Pygame to work with PyDev in Eclipse. I set up PyDev to use a custom-installed Python (not the default one). I forced this install to use 32-bit, which works fine in the Terminal - I can import Pygame, and other modules. However, when I use it in PyDev, it gives me a no matching architecture error. It also appears to be running in 64-bit mode.

The paths to the interpreter are the same.

import sys
print ("%x" % sys.maxsize, sys.maxsize > 2**32)

prints out ('7fffffff', False) while using Terminal, but in Eclipse/PyDev it prints out ('7fffffffffffffff', True)

The two paths (using sys.executable) are:
In Terminal it is: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

And in Eclipse it is /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

The path to the interpreter I used is: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
I also tried manually specifying the interpreter in Terminal - Using the above path. It worked.

The default python that comes with the system is /usr/bin/python

I am using a 32-bit version of Eclipse classic as shown by an answer to this question.

Does anyone have any idea what is wrong?

Community
  • 1
  • 1
Mercur1c
  • 11
  • 4

2 Answers2

0

You need to instruct eclipse to use 32-bit python.

Right-click on your project -> properties -> PyDen/Interpreter grammar and select "Click here to configure an interpreter not listed"

After you add your new python binary (e.g. C:\Python27\python.exe), you go back to the interpreter menu in the properties window and you select this interpreter from the corresponding drop-down menu.

Vasilis
  • 2,721
  • 7
  • 33
  • 54
  • I have setup Eclipse to use the 32-bit interpreter, and when I use that same interpreter in the Terminal it works fine, something in Eclipse is resetting it to 64 bit somehow. – Mercur1c Dec 16 '12 at 11:57
  • can you please write the full paths of your two interpreters including the binary name? E.g. C:/python/python.exe and C:/python64/python.exe – Vasilis Dec 16 '12 at 12:03
0

I solved this by using a method describe in an answer to another question.

The answer said to go to your plugins/org.python.pydev/pysrc and open interpreterInfo.py. Then you replace all the instances of sys.executable with the path to the interpreter you want. In my case, this meant changing them to /Library/Frameworks/Python.framework/Version/2.7/bin/python2.7

After that, open up eclipse and create a new interpreter with the same path, and it should work.

Community
  • 1
  • 1
Mercur1c
  • 11
  • 4