Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No matching distribution found for tkinter

Tags:

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!

like image 383
AnkP Avatar asked Dec 21 '16 16:12

AnkP


People also ask

How do I install tkinter on Windows?

The simplest method to install Tkinter in a Windows environment is to download and install either ActivePython 3.8 or 3.7 from here. Alternatively, you can create and activate a Conda environment with Python 3.7 or greater that is integrated with the latest version of Tkinter.

How do I import TK?

Import the Tkinter module. Create the GUI application main window. Add one or more of the above-mentioned widgets to the GUI application. Enter the main event loop to take action against each event triggered by the user.

How do I download tkinter from Pycharm?

To install tkinter in Pycharm, install the module “future” and restart pycharm. Tkinter will be imported.


2 Answers

Try this

sudo apt-get install python3-tk 

this worked for me

like image 56
Harsh Mathur Avatar answered Sep 28 '22 13:09

Harsh Mathur


Try with apt-get install python-tk

like image 37
Senthil Kumar Vaithiyanathan Avatar answered Sep 28 '22 12:09

Senthil Kumar Vaithiyanathan