在Linux Redhat 6上,从源代码构建并安装了python2.7,所以我们不会干扰2.66版本的系统python。
我们有一些使用tkinter的脚本,所以我运行了测试,它失败了。我在远程系统上看到弹出窗口,但弹出窗口为空,没有显示任何文本或按钮。
Python 2.7.6 (default, Aug 21 2014, 16:37:19)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>> Tkinter._test()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/local/lib/python2.7/lib-tk/Tkinter.py", line 3778, in _test
label = Label(root, text=text)
File "/home/local/lib/python2.7/lib-tk/Tkinter.py", line 2537, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "/home/local/lib/python2.7/lib-tk/Tkinter.py", line 2036, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError发布于 2019-02-21 09:44:13
Tkinter._test()检查是否一切正常。
通常,如果出现错误,说明tkinter没有正确安装,因此请重新安装Python,同时,请确保不要修改模块的代码。这也可能是一个问题。基本上,重新安装它。
https://stackoverflow.com/questions/25435765
复制相似问题