import problem in tkinter

Peter Otten __peter__ at
Fri Oct 30 19:57:31 CET 2009

Dave Angel wrote:

> Jebegnana das wrote:
>> import _tkinter # If this fails your Python may not be configured for Tk
>> I'm using python3 in linux. In windows tkinter is working fine but in
>> mandriva linux spring 2009 it fails to import. Can you please tell me
>> step-by-step on how to fix this issue? In python3.1 home page the
>> description is not clear or it can't be understood by the beginner. As
>> i'm a beginner for programming python in linux please help me out. I
>> want to know what is the thing i missed during installation. I've done
>> the things correctly as mentioned in the python readme text inside the
>> python3.1 tarball file. While searching the net i found out that if i
>> want to fix this issue i've to uninstall and install it again. what
>> should i do now?
>> With Regards,
>> Jebagnana Das.A,
>> Mob : +91-9843828383
>>       Now, send attachments up to 25MB with Yahoo! India Mail. Learn how.
> Is the working Windows version the same, or is it 2.x ?  The import name
> for tkinter changed from Tkinter in 2.x to tkinter in 3.x.  I don't
> think you ever need to import _tkinter directly.
> If you've tried
>   import tkinter
> and it fails in Python 3.x, then the next thing to do is look in the
> install directory.  For 3.x, in the Lib directory, look for a
> subdirectory called tkinter.  If it's there, and if it contains the file
>, then tkinter is supposedly installed.
> If it's really a Linux problem, I can't help further.

The necessary include files for tcl/tk are probably not found during the 
build process. These are in packages called tk-dev, tk-devel or similar, and 
can be installed using the distribution's package manager. After that Python 
can be built with Tkinter support. Note that you have to repeat all steps 
starting with 

$ ./configure


More information about the Python-list mailing list