cannot invoke IDLE

Juan M. Casillas juanm.casillas at eresmas.com
Sun Dec 1 17:19:25 EST 2002


Hello
n00b here: This is the output I get when I attempt to invoke IDLE for
Python 2.2.2. Consequently, I installed the 2.2.1 RPMs thinking this
would fix the problem, but nope ... same output:

	[username at localhost username]$ idle
	Traceback (most recent call last):
	  File "/usr/lib/python2.2/site-packages/idle/idle.py", line 3, 		in ?
import PyShell
  	  File "/usr/lib/python2.2/site-packages/idle/PyShell.py", line
		13, in ? from Tkinter import *
	  File "/usr/local/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


Hi

Question(s):
> 1. What did I do wrong (I just followed the default install)?


	The problem is this: you have a python version that doesn't include
	support for the tkinter module. This module requires tcl & tk
	libraries installed, so the first thing, is get this libraries
	(and their header files, if you plan to compile python) in your
	system, installed in any 'visible' location (/usr/lib, /usr/local/lib
	should work for you). Then you need a python package that support
	tkinter, or you can compile your own binary ;)

	You can install this libraries from the source files (the better, I think,
but
	more complex) or you can install them from any package of your distro.

	I prefer the compile-yourself method instead the package one, so
	here it is a simple recipe (I suppose that you have the tcl & tk
	libraries installed in your system yet)


2. How can I fix it?

	1 - Install tcl library & header files (/usr/lib or /usr/local/lib should
work)
	2 - Install tk library & header files (/usr/lib or /usr/local/lib should
work)

	3 - Install python from the source distribution:
		./configure --prefix=wherever-you-want
		take a peek at Modules/Setup.py (double check this, I'm using
		my weak 'brain-cache' to retrieve the file location :-)) This
		file has all the configuration for all python's modules. Try
		to search for 'tkinter' and check the values of the library
		files, include files, and so on.
		then make, make install (maybe you need to be root for issue
		the make install ...)

	Hope it works for you :)
	Kind Regards,

	print 'myself: %s' % 'Juan M. Casillas'







More information about the Python-list mailing list