【发布时间】:2016-05-10 02:19:46
【问题描述】:
我安装了适用于 Windows 的 Python 3.5.1(官方 python.org 安装程序),但它似乎缺少 tkinter。例如:
C:\Users\kostya>python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from tkinter import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'tkinter'
有人知道我可以下载这个包吗?
【问题讨论】:
-
你是怎么安装python的?
-
from tkdocs.com/tutorial/install.html "Tkinter(以及,自 Python 3.1 起,ttk)包含在所有标准 Python 发行版中。使用支持 Tk 的 Python 版本很重要8.5 或更高版本,以及 ttk。我们建议使用可从 python.org 下载的标准 Python 3.x Windows 安装程序。"
-
正是我所做的。我从 python.org 获取了 Python 3.5.1 安装程序
-
您可以通过导入另一个模块并将其显示为
__file__(例如import random ; print(random.__file__))来找到标准库所在的文件夹,然后转到该文件夹并查找名为tkinter的文件夹以查看如果它存在。 -
安装程序有一个选项“[X] install tkinter, IDLE, turtle”。默认情况下它应该是打开的,但您可能已经单击它关闭它。如果再次运行安装程序,您应该会看到一个修复选项。这应该让您可以选择查看该框是否被选中。必须确定它是并“修复”。
标签: python-3.x tkinter