/lib-tk/Tkinter.py", for Tk/python2.7/lib-dynload/_tkinter.so, hon2.

Joel Godin joel.godin at gmail.com
Sun Jul 31 15:19:38 CEST 2011


Also happens with python3.1 and OSX 10.6.8

import tkinter  #yields:


Traceback (most recent call last):
  File "imptk.py", line 1, in <module>
    import tkinter
  File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/tkinter/__init__.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dynload/_tkinter.so, 2): no suitable image found.  Did find:
	/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dynload/_tkinter.so: mach-o, but wrong architecture


> On Friday, June 25, 2010 4:54 AM Julien Pauty wrote:

> Dear list,
> 
> Last version of my software relies on ttk. Under windows and linux
> this is fine. But, OSX users are facing problems (I do not have access
> to a Mac myself for testing...). Those with OSX 10.6 can run the
> program. It seems that OSX 8.6 ships with Tk8.5.
> 
> People with OSX 8.5 cannot run the app. I told them to install python
> 2.7 which seems to be the first version on OSX to ship with Tk8.5.
> However, the program still does not run. I asked a person to launch a
> python 2.7 interpreter and try to import tkinter. This is an excerpt
> of the output:
> 
> =A0 from Tkinter import *
> =A0 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/l=
> ib-tk/Tkinter.py",
> line 39, in <module>
> =A0 =A0 import _tkinter # If this fails your Python may not be configured f=
> or Tk
> ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/p=
> ython2.7/lib-dynload/_tkinter.so,
> 2): no suitable image found. =A0Did find:
> =A0 =A0 =A0 =A0 /Library/Frameworks/Python.framework/Versions/2.7/lib/pytho=
> n2.7/lib-dynload/_tkinter.so:
> no matching architecture in universal wrapper
> 
> Full log is there: http://pastebin.com/vky8FbrP
> 
> I asked a person to simply open a python2.7 shell and import Tkinter.
> He got the same error.
> 
> All of this is executed with Python 2.7rc1. Archives that are on the
> ftp of python.org.
> 
> I have seen this bug http://bugs.python.org/issue9045, which is
> related, but deals with the specificities if OSX 64bit.
> 
> Can this problem be solved by installing Active TK 8.5 for OSX ?
> 
> Anybody knows what is the good combination of installer / libraries to
> install to run a ttk application on OSX 8.5 ? Ideally, I would like to
> document the setup procedure for 8.5 users.
> 
> Cheers,
> 
> Julien


>> On Friday, June 25, 2010 9:44 AM Kevin Walzer wrote:

>> There has been a lot of traffic on the MacPython list about this--see
>> the list archives.
>> 
>> --
>> Kevin Walzer
>> Code by Kevin
>> http://www.codebykevin.com


>>> On Friday, June 25, 2010 1:34 PM Jeff  Hobbs wrote:

>>> /lib-tk/Tkinter.py",
>>> for Tk
>>> /python2.7/lib-dynload/_tkinter.so,
>>> hon2.7/lib-dynload/_tkinter.so:
>>> 
>>> The OS X equation is confuzzulating due to version and API changes in
>>> Mac OS X.  Let's review ...
>>> 
>>> OS X 10.5 ships Tcl/Tk 8.4 built 32-bit only i386+ppc using Carbon.
>>> OS X 10.6 ships Tcl/Tk 8.5 built 32/64 i386+x86_64 using Cocoa.
>>> 
>>> The Cocoa port of Tk was necessary for 64-bit support, as Apple never
>>> did supply the promised 64-bit Carbon.  Tk 8.5 has Cocoa as an option,
>>> and it is default in Tk 8.6.
>>> 
>>> ActiveTcl 8.5 still ships as 32-bit i386+ppc Carbon because going to
>>> Cocoa also means you have to drop OS X 10.4 support (out of curiousity
>>> - does anyone care about OS X 10.4 anymore that is not stuck on what is
>>> already installed?).  8.5 plans to do so later this year (leaving
>>> behind our OS X 10.4 brethren to older versions).  ActiveTcl 8.6 (Tcl/
>>> Tk 8.6 is in beta) already ships i386+x86_64 Cocoa.
>>> 
>>> Now there is the issue that Tkinter links to a specific version of Tcl/
>>> Tk.  I am currently working on a patch that will remove this
>>> limitation (making the binary Tk version independent).
>>> 
>>> So what do you do?
>>> 
>>> Well, it depends on what mix you are trying to make.  The easiest is
>>> to just run
>>> arch -i386 python2.7
>>> and then it will find the compatible i386 Tk.  The next release of
>>> ActivePython 2.7 (which is building i386+x86_64) will have the Tk
>>> version independence, so it could work with core Tk or AT 8.6, or 8.5
>>> in 32-bit mode.
>>> 
>>> Less confuzzulated?
>>> 
>>> Jeff






More information about the Python-list mailing list