2017-03-02 61 views

回答

1

尝试使用 进口Tkinter的 (小“T”,而不是资本)

+0

我试过了。它在ImageTk.py文件中,当我改变它时不起作用 – Caleb

+0

然后我认为tkinter模块没有安装。请检查并尝试安装它,如果它没有安装在cmd中使用此代码'python -m pip install tkinter' –

0

如果您更清晰地读出错误,它在一个评论说,如果进口_tkinter失败,您的计算机未配置为使用Tkinter的。你应该下载tk和ttk来使它工作。

,并根据http://wiki.python.org/moin/TkInter

If it fails with "No module named _tkinter" or "Tkinter", your Python configuration needs to be modified to include this module (which is an extension module implemented in C). Do not edit Modules/Setup (it is out of date). You may have to install Tcl and Tk (when using RPM, install the -devel RPMs as well) and/or edit the setup.py script to point to the right locations where Tcl/Tk is installed. If you install Tcl/Tk in the default locations, simply rerunning "make" should build the _tkinter extension.

+0

当我将它在shell中运行并将其作为.py文件运行时,它完美运行。我需要安装它才能发生,还是仅仅为了冻结? – Caleb

+0

您也可以尝试在setup.py文件中包含tkinter – abccd

相关问题