一开始我用的是centos自带的python,是2.4版本的,在那我按住那个了tkinter,可参考步骤:
yum install tkinter yum install python-imaging yum install python-tools
后来心血来潮升级python版本:可以参考这http://www.cnblogs.com/lanxuezaipiao/archive/2012/10/21/2732864.html
升级后发现yum貌似用不了了,解决步骤:
$ yum
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax
修改yum的解释器为旧版本python2.4:
vi /usr/bin/yum
将第一行"#!/usr/bin/python" 改为 "#!/usr/bin/python2.4"即可
发现tkinter也用不了了,于是有下列步骤:经过这些步骤就能用了,并且还安装了idle开发环境
安装IDLE开发环境
sudo yum install python-tools
IDLE can't import Tkinter. Your Python may not be configured for Tk. 错误解决
sudo yum install tk-devel tcl-devel
//重新编译安装python3.3.0
sudo rm /usr/local/python3 -rf
./configure --prefix=/usr/local/python3
make
make install