View Full Version : python 2.4 - 'No module named _tkinter'

18th May 2006, 12:53 PM
I'm trying to run a Pyhthon program that uses tkinter and I get the following message:

Traceback (most recent call last):
File "iodef.py", line 10, in ?
import pkgview
File "/home/jja/prog/python/iodef/lib/pkgview.py", line 3, in ?
from Tkinter import *
File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", line 38, in ?
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter

I've done some searches on the internet and it looks like I need to build my own version of python, tcl and tk. Does anyone know if there is an easier solution?

Jim Anderson

18th May 2006, 01:03 PM
yum install python-tools

Tkinter is included I think.

18th May 2006, 01:10 PM
Actually, if you just need tkinter, try

yum install tkinter

Yum will take care of the other dependencies.

18th May 2006, 05:13 PM
I'm new to using yum and I'm not familiar with it. I ran the
command that you suggested and got:

yum install tkinter
The yum libraries do not seem to be availableon your system for this version of python 2.4.3 (#1, May 17 2006, 20:48:36)
[GCC 4.0.0 20050519 (Red Hat 4.0.0-8)]
Please make sure the package you used to installyum was built for your install of python.

I read up a bit on yum, but it is not clear to me where yum finds dependency information or where it finds the packages that it is going to use for installation.

18th May 2006, 05:32 PM
Looks like you are running Python 2.4.3. I think the tkinter FC5 package available through yum is based on Python 2.4.2.

What method did you use to install Python 2.4.3?

18th May 2006, 05:51 PM
I download Python from python.org and did a: configure, make, make install.

18th May 2006, 05:52 PM
Should I remove python 2.4.3 and install and older version that goes with FC4?

18th May 2006, 05:57 PM
This question may be beyond my knowledge. What I will say is that with a distro like Fedora (I use FC5) I think it is best to use the rpm packages provided by the project. That way things will work well together. I have not intsalled Python from source as you have so I really can't say for sure how you should proceed. I'm sure someone around here can get you headed in the right direction.