Linux下使用Python的Tkinter库出现的No module named _tkinter问题
2011-10-13 10:59
866 查看
在Linux下使用Tkinter库,出现如下问题
File "/usr/local/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
Python的版本信息如下:
>>> import sys
>>> sys.version
'2.7 (r27:82500, Oct 11 2011, 13:51:21) \n[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)]'
经过艰苦绝伦的Google,查明问题出现原因,Tk/Tcl的组件安装不完全
问题解决:
下载Tk和Tcl,从www.scriptics.com上的链接下载tcl和tk的安装文件
现在最新的版本是8.4.4
http://prdownloads.sourceforge.net/tcl/tcl8.4.4-src.tar.gz
http://prdownloads.sourceforge.net/tcl/tk8.4.4-src.tar.gz
安装:
tar -zvxf tcl8.4.4.tar.gz
cd tcl8.4..4/
cd unix
./configure
make
make install
此时键入命令tclsh84,就可以使用tcl了
step3 安装tk与安装tcl类似
tar -zvxf tk8.4.4.tar.gz
cd tk8.4.4/
cd unix
./configure
make
make install
执行wish84就可以使用tk了。
注:安装tcl和tk的时候,make install 需要管理员的权限
安装完成了,重新make Python,然后,Tkinter库可以正常调用了
>>> from Tkinter import *
>>>
File "/usr/local/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
Python的版本信息如下:
>>> import sys
>>> sys.version
'2.7 (r27:82500, Oct 11 2011, 13:51:21) \n[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)]'
经过艰苦绝伦的Google,查明问题出现原因,Tk/Tcl的组件安装不完全
问题解决:
下载Tk和Tcl,从www.scriptics.com上的链接下载tcl和tk的安装文件
现在最新的版本是8.4.4
http://prdownloads.sourceforge.net/tcl/tcl8.4.4-src.tar.gz
http://prdownloads.sourceforge.net/tcl/tk8.4.4-src.tar.gz
安装:
tar -zvxf tcl8.4.4.tar.gz
cd tcl8.4..4/
cd unix
./configure
make
make install
此时键入命令tclsh84,就可以使用tcl了
step3 安装tk与安装tcl类似
tar -zvxf tk8.4.4.tar.gz
cd tk8.4.4/
cd unix
./configure
make
make install
执行wish84就可以使用tk了。
注:安装tcl和tk的时候,make install 需要管理员的权限
安装完成了,重新make Python,然后,Tkinter库可以正常调用了
>>> from Tkinter import *
>>>
相关文章推荐
- Linux下使用Python的Tkinter库出现的No module named _tkinter问题
- Linux下python2.7出现No module named _struct问题
- Linux下python2.7出现No module named _struct问题
- Linux下python2.7出现No module named _struct问题
- Linux下python2.7出现No module named _struct问题
- Linux下python2.7出现No module named _struct问题
- Linux下python2.7出现No module named _struct问题
- 全网最详细的跑python2.7时出现from mysql import connector ImportError: No module named mysql的问题解决办法(图文详解)
- python模块以及导入出现ImportError: No module named 'xxx'问题
- ubuntu使用python setup.py install出现No module named setuptools
- Python使用libsvm的“ImportError: No module named svmutil”问题
- python模块以及导入出现ImportError: No module named 'xxx'问题
- Python使用libsvm的“ImportError: No module named svmutil”问题
- (Python问题二) Django Python 出现 No module named ‘MySQLdb
- centos7升级python,yum出现问题“ImportError: No module named urlgrabber.grabber”
- 安装Python使用出现“No module named yum”
- python 解决No module named 'MySQLdb'的问题
- 用pycharm+flask 建立项目以后运行出现ImportError: No module named flask-login问题
- ubuntu下运行Python程序出现ImportError: No module named skimage
- centos6.8 安装Python2.7后, yum出现“No module named yum”错误