【发布时间】:2011-07-24 11:39:32
【问题描述】:
今天我想开始使用 Tkinter,但我遇到了一些问题。
Python 3.2 (r32:88445, Mar 28 2011, 04:14:07)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from tkinter import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.2/tkinter/__init__.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
那么如何配置我的 Python 3.2 以使用 Tkinter?
【问题讨论】:
-
虽然这不能直接回答您的问题,但如果您希望在 Linux 上使用最新的 Python,使用预编译的二进制文件(例如 ActivePython - 包括 Tkinter)将节省大量时间。
-
每个 Linux 发行版都有一个官方的 python 包。除非您需要特定的东西,否则实际上不鼓励使用 3rd 方二进制文件。也就是说,在 python 中支持 Tk 可能只需要一两个命令,但我需要知道你运行的是哪种 Linux。
标签: python python-3.x tkinter