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!
Try this
sudo apt-get install python3-tk
this worked for me