Configuring Python for Tk on Mac
craig at postnewspapers.com.au
Fri Jan 21 13:57:53 EST 2005
On Fri, 2005-01-21 at 07:39 -0800, Martyn Quick wrote:
> On my desk here at work I have a Mac G4 running Mac OS X v10.2.8.
> When I go into a terminal and type "python" up comes a nice python
> interface and all seems great. However when I type "import Tkinter"
> I'm greeted by the following error.
> >>> import Tkinter
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 35, in ?
> import _tkinter # If this fails your Python may not be configured
> for Tk
> ImportError: No module named _tkinter
> So I guess something about this implementation is not appropriately
In general, that error means that Python can't find the C extension
module used to provide the low-level interface for Tkinter. It's not
installed, can't be found (library path or python path issues), can't be
opened (permissions), etc.
Note the comment in the error message to that effect.
I've just checked the OSX 10.3 machine here, and it fails to import
tkinter there too. I'd say Apple just don't build Python with Tk
> What do I do to set it up so I can use Tkinter?
Try Google - this seems to be a moderately FAQ for MacOS/X.
More information about the Python-list