python中的Tkinter - 未找到

时间:2018-04-27 11:06:42

标签: python python-2.7 tkinter

我想在python 2.7中使用tkinter,但它说,找不到它。我也不能使用pip install安装它。如何安装?

Python 2.7.5 (default, Nov  6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named tkinter

>>> import Tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Tkinter
>>>



pip install tkinter
Collecting tkinter
  Could not find a version that satisfies the requirement tkinter (from versions: )
No matching distribution found for tkinter


 pip install Tkinter
Collecting Tkinter
  Could not find a version that satisfies the requirement Tkinter (from versions: )
No matching distribution found for Tkinter

1 个答案:

答案 0 :(得分:0)

您需要安装python-tk包:

apt install python-tk