Python 没有找到 tkinter 的匹配分布
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41267709/
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
No matching distribution found for tkinter
提问by AnkP
I am stuck with this issue since last two days and I have tried every possible solution on the stack and github. It will be really great if someone can recommend.
自过去两天以来,我一直在解决这个问题,并且在堆栈和 github 上尝试了所有可能的解决方案。如果有人可以推荐,那就太好了。
I am working with python 2.7 in a virtual environment on CentOS Linux release 7.3.1611.
我正在 CentOS Linux 7.3.1611 版的虚拟环境中使用 python 2.7。
I am running a script that uses matplotlib.pyplot and on run gives this error
我正在运行一个使用 matplotlib.pyplot 的脚本并在运行时出现此错误
import matplotlib.pyplot as plt
File "/usr/local/packages/Python-2.7/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
I tried to install tkinter using -
我尝试使用 - 安装 tkinter
pip install tkinter and it gave this error
Could not find a version that satisfies the requirement tkinter (from versions: )
No matching distribution found for tkinter
then I even installed -
然后我什至安装了 -
sudo yum install tk
sudo yum install tk-devel
sudo yum install tc
and it says packages are already installed and nothing to to
它说已经安装了软件包并且 nothing to to
I have set up my virtual environment again to see if I missed something but I cannot get anywhere. Please help!
我再次设置了我的虚拟环境,看看我是否错过了什么,但我无法到达任何地方。请帮忙!
回答by Harsh Mathur
Try this
尝试这个
sudo apt-get install python3-tk
this worked for me
这对我有用
回答by Roy Holzem
had same issue: yum install tkinter
for CentOS and RedHat for python 2.x!
有同样的问题:yum install tkinter
对于 CentOS 和 RedHat for python 2.x!
回答by Calvin Drawbridge
For people still experiencing this issue, try to change your Python project interpreter. Tkinter should be included by default, but it is possible that your distribution does not have it included. Always download the latest base interpreter from the official site.
对于仍然遇到此问题的人,请尝试更改您的 Python 项目解释器。默认情况下应该包含 Tkinter,但您的发行版可能没有包含它。始终从官方网站下载最新的基本解释器。
回答by Senthil Kumar Vaithiyanathan
Try with apt-get install python-tk
试试 apt-get install python-tk
回答by sagarreddy
sudo yum install python-tools -y
This worked for me on Amazon Linux 2.
这在 Amazon Linux 2 上对我有用。
回答by Hymaner_wei
I had the same error as you, I try installing dependencies, tk/tcl, but it didn't work. Finally I solved it using:
我和你有同样的错误,我尝试安装依赖项,tk/tcl,但是没有用。最后我使用以下方法解决了它:
sudo apt-get update
sudo apt-get install python-tk
on ubuntu16.04
在 ubuntu16.04 上
回答by Edward Park
Since you are using python 2.7 tkinter is Tkinter. Try importing Tkinter.
由于您使用的是 python 2.7 tkinter 是 Tkinter。尝试导入 Tkinter。