2011-09-09 147 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。只是为了未来的知识。