No matching distribution found for tkinter

57.5k Views Asked by At

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.

I am working with python 2.7 in a virtual environment on CentOS Linux release 7.3.1611.

I am running a script that uses matplotlib.pyplot and on run gives this error

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 -

 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

I have set up my virtual environment again to see if I missed something but I cannot get anywhere. Please help!

7

There are 7 best solutions below

6
On

Since you are using python 2.7 tkinter is Tkinter. Try importing Tkinter.

https://docs.python.org/2/library/tkinter.html

0
On

Try with apt-get install python-tk

0
On

I had the same error as you, I try installing dependencies, tk/tcl, but it didn't work. Finally I solved it using:

sudo apt-get update
sudo apt-get install python-tk

on ubuntu16.04

0
On

had same issue: yum install tkinter for CentOS and RedHat for python 2.x!

0
On
sudo yum install python-tools -y

This worked for me on Amazon Linux 2.

0
On

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.

3
On

Try this

sudo apt-get install python3-tk

this worked for me