Chinaunix首页 | 论坛 | 博客
  • 博客访问: 103728552
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: LINUX

2008-04-13 20:40:07

作者: tljhl 出自:
Tkinter是Python的GUI widget。

一般情况下Linux都没有自带,要自己安装。

1、确定Tkinter没有安装:
zhancang@debian:~$ python
Python 2.4.4 (#2, Apr 5 2007, 20:11:18)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
Traceback (most recent call last):
File "", line 1, in ?
File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 41, in ?
raise ImportError, str(msg) + ', please install the python-tk package'
ImportError: No module named _tkinter, please install the python-tk package
>>>

2、安装Tkinter:
zhancang@debian:~$ su -
Password:
debian:~# aptitude install python-tk
Reading package lists... Done
Building dependency tree... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Reading task descriptions... Done
Building tag database... Done
The following NEW packages will be automatically installed:
blt tk8.4
The following NEW packages will be installed:
blt python-tk tk8.4
0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 2565kB of archives. After unpacking 6676kB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
Get:1 etch/main tk8.4 8.4.12-1etch2 [978kB]
Get:2 etch/main blt 2.4z-4 [1528kB]
Get:3 etch/main python-tk 2.4.4-1 [59.4kB]
Fetched 2565kB in 2s (918kB/s)
Selecting previously deselected package tk8.4.
(Reading database ... 72536 files and directories currently installed.)
Unpacking tk8.4 (from .../tk8.4_8.4.12-1etch2_i386.deb) ...
Selecting previously deselected package blt.
Unpacking blt (from .../archives/blt_2.4z-4_i386.deb) ...
Selecting previously deselected package python-tk.
Unpacking python-tk (from .../python-tk_2.4.4-1_i386.deb) ...
Setting up tk8.4 (8.4.12-1etch2) ...

Setting up blt (2.4z-4) ...

Setting up python-tk (2.4.4-1) ...
debian:~#

3、安装成功:
zhancang@debian:~$ python
Python 2.4.4 (#2, Apr 5 2007, 20:11:18)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>>
阅读(1044) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~