2011-09-09 45 views
-4

導入Tkinter的我碰到下面的錯誤,同時導入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 
>>> 

我該怎麼辦?

回答

1

可能只是安裝Tkinter - 也許apt-get install python-tk將做到這一點,如果你有一個基於Debian的發行版。可能是python3-tk或其他發行版的其他內容。

0

你可以嘗試這樣做,而不是

from tkinter import * 

我不知道爲什麼,但是這似乎工作福爾我只是從Tkinter的進口一切手段。 另一件事他們在python 3.5中將其更改爲小寫字母t。只是爲了未來的知識。