2017-03-02 126 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

相關問題