未分类
Python3: No module named ‘_tkinter’解决
2019-09-12更新: 参考: https://www.z1987.com/blog/detail/c1570f5604fbcee5020dd8a5fabf01d0 发现个更简单的做法:
1 |
yum install tkinter |
1 2 3 |
On CentOS 7 and Python 3.4, the command is sudo yum install python34-tkinter On Redhat 7.4 with Python 3.6, the command is sudo yum install rh-python36-python-tkinter |
我的是Python7.6, 故安装:
1 |
yum install python36-tkinter |
旧: 在实验用networkx画图时, 在执行如下命令时报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
In [1]: import tkinter --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-1-29b37e014535> in <module>() ----> 1 import tkinter /usr/local/python3.7/lib/python3.7/tkinter/__init__.py in <module>() 34 import sys 35 ---> 36 import _tkinter # If this fails your Python may not be configured for Tk 37 TclError = _tkinter.TclError 38 from tkinter.constants import * ModuleNotFoundError: No module named '_tkinter' |
环境介绍 centos: 7.6.1810 Python: 3.7.4 基于virutalenv来切换不同的Python环境 什么是tkinter, tcl ,tk The tkinter package (“Tk interface”) is the standard Python interface to the Tk GUI toolkit. Both Tk and tkinter are available on most Unix platforms, as well Read more…