-4

I get the following error while importing Tkinter:

Python 2.7.1 (r271:86832, Jun 11 2011, 11:34:27) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/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
>>> 

What shall I do?

joaquin
  • 82,968
  • 29
  • 138
  • 152
Tofayel Ahmed
  • 375
  • 1
  • 3
  • 5

2 Answers2

1

Probably just install Tkinter - maybe apt-get install python-tk will do it if you have a Debian based distribution. Might be python3-tk or something else for other distributions.

patthoyts
  • 32,320
  • 3
  • 62
  • 93
-1

You can try doing instead

from tkinter import *

I dont know why but this seems to work foor me it just means from tkinter import all. another thing they changed it in python 3.5 to a lower case t. just for future knowledge.

yo halbe
  • 23
  • 1
  • 9