在 Canopy 中安装 tkinter 时出现问题

问题描述 投票:0回答:0

我使用 Enthought Canopy 作为我的 Python 3 环境,我最近得到了一台新的 Windows 机器。从 Mac 切换到 Canopy 后,我的所有模块都从头开始。我最近一直在搞乱 GUI,当我在我的新机器上启动一个小应用程序时,我尝试

import tkinter
但得到了这个回溯:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-5-b98d59735c04> in <module>()
----> 1 import tkinter

C:\Users\User\AppData\Local\Enthought\Canopy\edm\envs\User\lib\tkinter\__init__.py in <module>()
     33 import sys
     34 
---> 35 import _tkinter # If this fails your Python may not be configured for Tk
     36 TclError = _tkinter.TclError
     37 from tkinter.constants import *
ImportError: DLL load failed: The specified module could not be found. 

令我困惑的是,我的其余 Canopy 模块所在的 tkinter 文件夹中,错误实际上来自 __init__.py

布丁真的在那个 __init__ 文件的第 35 行,它说“如果失败,你的 Python 可能没有为 Tk 配置”。 IIrc,我的 Canopy Mac 设置已经有 Tkinter,或者它在 Canopy 的包管理器中,使安装变得非常快速和轻松。它不在 Canopy 的包管理器中,在任何 Canopy 存储库中。

python tkinter enthought canopy
© www.soinside.com 2019 - 2024. All rights reserved.