美文网首页
CentOS解决Tkinter: “Python may not

CentOS解决Tkinter: “Python may not

作者: 知微见珠 | 来源:发表于2018-02-10 11:59 被阅读0次

在centos上使用wordcloud生成词云时,遇到以下错误

import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter

第一反应就是通过pip安装,但发现并没有该模块

原来 Tkinter 是内置到 python 的安装包中的,如果系统中装好依赖的库,只要安装好 Python 之后就能 import Tkinter ,所以问题在于安装Python前没有安装Tkinter的依赖库

解决方法

yum -y install tk-devel
# 重新编译Python
make && make install

相关文章

网友评论

      本文标题:CentOS解决Tkinter: “Python may not

      本文链接:https://www.haomeiwen.com/subject/mcpctftx.html