0

I've written a Python script using tkinter. However today, after updating homebrew, I'm getting the following error:

No module named _tkinter

when I try to import tkinter.

Interactive terminal looks like this:

>>> import Tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/lib-tk/Tkinter.py"line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
>>> 

When I try to import _tkinter I get this:

ImportError: No module named _tkinter
nbro
  • 15,395
  • 32
  • 113
  • 196
  • So... what's your question? – Alejandro Aug 06 '15 at 21:22
  • How do I fix the error? @Alejandro – Daniel Trosten Aug 07 '15 at 07:17
  • Check these posts: http://stackoverflow.com/questions/5459444/tkinter-python-may-not-be-configured-for-tk, http://stackoverflow.com/questions/6320954/idle-cant-import-tkinter-your-python-may-not-be-configured-for-tk. When you have a specific error or exception like this, you should copy exactly the key part of the traceback, in this case `ImportError: No module named _tkinter`, and past it on google search box, and then click `Google Search` , and usually you are lucky ;) – nbro Aug 08 '15 at 09:20

1 Answers1

-3

Well Tkinter is the GUI library that comes in python as default. If you can't call Tkinter that means your python installation is corrupted. Re-installing your python should fix it.

Phaneendra
  • 421
  • 4
  • 7