[Tutor] Tkinter import error

Luke Paireepinart rabidpoobear at gmail.com
Tue Apr 24 00:51:22 CEST 2007


John DeStefano wrote:
> Hi all,
>
> I've been lurking for a while; I'm just picking up Python and most of
> the posts have been a bit over my head.
>
> I've run into an error that I've seen reported in several places, but
> none of the fixes seem to be working for me: when I try to "import
> Tkinter" I get a configuration error:
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python2.5/lib-tk/Tkinter.py", line 38, in <module>
>     import _tkinter # If this fails your Python may not be configured for Tk
> ImportError: No module named _tkinter
>
> I actually have 2.3, 2.4, and 2.5 on this system (RHEL4 Linux), and I
> compiled 2.5 from scratch.  I've tried installing the tkinter package
> for my OS and re-compiling Python (with both "make clean" and "make
> distclean" first), but I still get the same error.  I also checked to
> make sure that "Tkinter.py" exists in the path shown in the error, and
> it is there (dated the last time I recompiled Python 2.5).
>
> What else can I try?
>   
So the problem is in your 2.5 install?
Can you just use a binary package or do you need to compile from scratch?
You can use the #! first line in your source code to specify which 
Python interpreter to use, I believe,
so you could direct it at one of your other installs for now until you 
get 2.5 working....
Just a thought.
-Luke


More information about the Tutor mailing list