赞
踩
本文由我司收集整编,推荐下载,如有疑问,请与我司联系
Linux Python
找不到
Tkinter
模块
2014/12/15 0
一、安装
tkinter
在
Linux
中
默认是不安装
Tkinter
模块,
123456789[root@li250-193
~]#
pythonPython
2.6.6
(r266:84292,
Feb
22
2013,
00:00:18)[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2Type help , copyright , credits
or license for more information. importTkinterTraceback (most recent call last):File stdin ,
line 1,in module ImportError: No module named Tkinter
我们安装
Tkinter
模块
12345678[root@li250-193
~]#
yum
-y
install
tkinter...[root@li250-193
~]#
pythonPython 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)[GCC 4.4.7 20120313 (Red Hat
4.4.7-3)]
on
linux2Type
help
,
copyright
,
credits
or
license
for
more
information.
importTkinter
二、升级
PythonLinux
的
Python
版本默认都不叫低
查看
Python
版本
12[root@li250-193 ~]# python -VPython 2.6.6DOWN
新版本
1[root@li250-193 ~]# wget python/ftp/python/2.7.4/Python-2.7.4.tgz
解压安装
12345678[root@li250-193 ~]# tar -xf Python-2.7.4.tgz[root@li250-193 ~]# cd Python-
2.7.4[root@li250-193
Python-2.7.4]#
./configure...[root@li250-193
Python-2.7.4]#
make...[root@li250-193 Python-2.7.4]# make install...
看看新版本
Python
是否可以使用
Tkinter
?
1234567891011[root@li250-193
Python-2.7.4]# ./pythonPython
2.7.4
(default,
Apr
12
2013, 08:03:09)[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2Type help , copyright ,
credits
or
license
for
more
information.
importTkinter
Traceback
(most
recent
call
last):File stdin , line 1,in module File /root/Python-2.7.4/Lib/lib-tk/Tkinter.py , line 39,in
module
import_tkinter
#
If
this
fails
your
Python
may
not
be
configured
for
TkImportError:
No
module
named
_tkinter
提示找不到
tkinter
模块?看看旧版的是不
是正常
123456[root@li250-193 Python-2.7.4]# pythonPython 2.6.6 (r266:84292, Feb 22 2013,
00:00:18)[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2Type help , copyright , credits
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。