Python 为什么找不到 tkinter 发行版?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39928710/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 22:55:43  来源:igfitidea点击:

Why is there no tkinter distribution found?

pythontkintermodule

提问by Syed Hissaan

I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinteron dos but it shows the following message:

我在安装 tkinter 时遇到问题。我有 2.7.11 版。我输入了pip install tkinteron dos 但它显示以下消息:

collecting tkinter

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

收集 tkinter

找不到满足 tkinter 要求的版本(来自版本:) 找不到与 tkinter 匹配的发行版

I have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?

我已经使用相同的程序成功安装了烧瓶,但对于 tkinter,它显示了问题。我怎样才能摆脱这个问题?

采纳答案by Prabhakar

The Tkinter library comes in default with every Python installation

Tkinter 库在每个 Python 安装中都是默认的

Try this:

尝试这个:

import Tkinter as tk

回答by Senthil Kumar Vaithiyanathan

You should install

你应该安装

apt-get install python-tk

This should solve your issue

这应该可以解决您的问题

回答by Khushhalm

Follow this guide to install "tkinter". However now with Python version 3.1 onwards, it is part of the standard python distribution.

按照本指南安装“tkinter”。但是现在从 Python 3.1 版开始,它是标准 Python 发行版的一部分。

You can also install it using sudo apt-get install python3-tk-dbg, if you are in virtualenv. (Same can be done for normal installation, not just virtualenv)

sudo apt-get install python3-tk-dbg如果您在 virtualenv 中,您也可以使用,安装它。(正常安装也可以,不仅仅是virtualenv)

回答by costamatrix

to find your package run:

找到你的包运行:

sudo yum search python|grep tk

须藤 yum 搜索 python|grep tk

mine was:

我的是:

yum install python3-tkinter.x86_64

yum 安装 python3-tkinter.x86_64

回答by Geetha

the below answer in for Windows:

Windows 中的以下答案:

after installing Tk in your windows machine by following the instructions mentioned in the following link (https://tkdocs.com/tutorial/install.html#installwin), import tkinter as tk (for python3) or import Tkinter as tk (for python2). FYI - 'Tkinter' has been renamed as 'tkinter' in python3. It worked well for me.

按照以下链接(https://tkdocs.com/tutorial/install.html#installwin)中提到的说明在 Windows 机器上安装 Tk 后,将 tkinter 导入为 tk(对于 python3)或将 Tkinter 导入为 tk(对于 python2 )。仅供参考 - 'Tkinter' 已在 python3 中重命名为 'tkinter'。它对我来说效果很好。

回答by ongja teenage

pip shown Could not find a version that satisfies the requirement python--tkinter(from versions: ) No matching distribution found for python--tkinterYou are using pip version 10.0.1, however version 19.0.3is available. You should consider upgrading via the python -m pip install --upgrade pipcommand.

显示的 pip 找不到满足要求的python--tkinter版本(来自版本:)没有找到与python--tkinter您正在使用的匹配的发行版pip version 10.0.1,但是version 19.0.3可用。您应该考虑通过python -m pip install --upgrade pip命令进行升级。

回答by sagarreddy

I was able to fix this on Amazon Linux 2 with python2.7by running this sudo yum install python-tools -ycommand.

python2.7通过运行此sudo yum install python-tools -y命令,我能够在 Amazon Linux 2 上修复此问题。

回答by Bobbyy Tables

I had to install python3-tk manually before it worked (via apt-get)

我必须在 python3-tk 工作之前手动安装它(通过 apt-get)