我用cx_freeze凍結了一個python 3.6程序,它工作得很好。但只要我試圖運行它,我收到了這個錯誤信息。
Python 3.6 cx_freeze ModuleNotFoundError:沒有名爲Tkinter的模塊
有誰知道該怎麼辦?請幫忙!
我用cx_freeze凍結了一個python 3.6程序,它工作得很好。但只要我試圖運行它,我收到了這個錯誤信息。
Python 3.6 cx_freeze ModuleNotFoundError:沒有名爲Tkinter的模塊
有誰知道該怎麼辦?請幫忙!
嘗試使用 進口Tkinter的 (小「T」,而不是資本)
如果您更清晰地讀出錯誤,它在一個評論說,如果進口_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.
我試過了。它在ImageTk.py文件中,當我改變它時不起作用 – Caleb
然後我認爲tkinter模塊沒有安裝。請檢查並嘗試安裝它,如果它沒有安裝在cmd中使用此代碼'python -m pip install tkinter' –