_tkinter.TclError: Can't find a usable tk.tcl in the following directories

_tkinter.TclError: Can't find a usable tk.tcl in the following directories

我尝试了 Whosebug 上所有以前可用的解决方案,但似乎没有任何效果。 我正在使用 Anaconda 的 64 位 pythonpython 3.6.1

这是我在 运行 我的 exe:

时收到的错误消息
Traceback (most recent call last):

File "C:\Users\Asgard\Anaconda3\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
    module.run()
  File "C:\Users\Asgard\Anaconda3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
    exec(code, m.__dict__)
  File "fbroi.py", line 80, in <module>
    root = Tk(className=" ROI Calculator")
  File "C:\Users\Asgard\Anaconda3\lib\tkinter\__init__.py", line 2017, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable tk.tcl in the following directories:
    {C:\Users\Asgard\Desktop\ML Proj\EdCrawler\build\exe.win-amd64-3.6\tk} {C:/Users/Asgard/Desktop/ML Proj/EdCrawler/build/exe.win-amd64-3.6/tcl/tk8.6} {C:/Users/Asgard/Desktop/ML Proj/EdCrawler/build/exe.win-amd64-3.6/tk8.6} {C:/Users/Asgard/Desktop/ML Proj/EdCrawler/build/lib/tk8.6} {C:/Users/Asgard/Desktop/ML Proj/EdCrawler/lib/tk8.6} {C:/Users/Asgard/Desktop/ML Proj/EdCrawler/build/library}

到处复制 tcl8.6 和 tk8.6 目录,似乎也不起作用。

好的, 似乎对我来说没有可能的解决方案。我不得不摆脱 cx_Freeze.

对我有用的是:

  1. 将你的 python 降级到 3.3 或更低,因为 py2exe 不支持 python 3.6。如果您正在使用 conda 创建一个 虚拟环境 。它很容易允许安装任何你想要的 python 版本。
  2. 在您的 python 环境中获取 py2exe
  3. 使用py2exe

您可能会发现这很有用:py2exe usage on Whosebug.

对于使用 conda 的人:python and conda