No matches found for tkinter

I’ve been stuck on this issue from the last two days, and I have tried all possible solutions in the stack and github. It will be great if someone can recommend.

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

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

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 installing 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 he says the packages are already installed and nothing to to

I set up my virtual environment again to see if I missed something, but I can't go anywhere. Please help!

+7
python module tkinter tk
source share
4 answers

Try this $ sudo apt-get install python3-tk it worked for me

+5
source share

Try with apt-get install python-tk

+1
source share

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

+1
source share

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

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

-2
source share

All Articles