49

I am having a problem during the installation of tkinter. I have version 2.7.11. I entered the pip install tkinter on dos but it shows the following message:

collecting tkinter

Could not find a version that satisfies the requirement tkinter (from versions:) No matching distribution found for tkinter

I have successfully installed flask with the same procedure, but for tkinter it is showing problem. How can I get rid of this problem?

Jack Duane
  • 185
  • 3
  • 17
Hissaan Ali
  • 2,229
  • 4
  • 25
  • 51

15 Answers15

40

You should install

apt-get install python-tk

This should solve your issue

25

The Tkinter library comes in default with every Python installation

Try this:

import Tkinter as tk
Prabhakar
  • 1,138
  • 2
  • 14
  • 30
  • 2
    oh yes i got that , i think i got stuck at the caps , i used `import tkinter ` rather than `import Tkinter ` i dint thought that this issue may arise , well thanks for the answer ! – Hissaan Ali Oct 08 '16 at 13:39
  • 5
    @Syed `tkinter` will be correct when you use 3.x. The names of submodules also change. `TkFont` becomes `tkinter.font`. And so on. – Terry Jan Reedy Oct 08 '16 at 23:36
  • @Prabhakar , got that ! – Hissaan Ali Oct 15 '16 at 04:12
  • 9
    @Terry Jan Reedy: I am using 3.6 and import tkinter does not work. And when trying pip install tkinter, I get 'No matching distribution' also. – Yster Jun 08 '17 at 14:47
  • I get the same @SyedHissaan problem with "pip install Tkinter". The system returns an error message when I run on jupyter `import Tkinter as tk` ---> `ModuleNotFoundError: No module named 'Tkinter'` – Andrea Ciufo Sep 04 '18 at 10:30
  • If you have python 2.x and 3.x installed on your machine as me, make sure you use `python3 XXX.py` instead of `python XXX.py` to run this script. – sh87 Nov 01 '18 at 18:53
  • ModuleNotFoundError: No module named 'Tkinter' – alper Dec 03 '20 at 23:10
7

This will work for tkinter installment

pip install tk
python -m pip install tk
Karan Gehlod
  • 134
  • 1
  • 9
3

Follow this guide to install "tkinter". However now with Python version 3.1 onwards, it is part of the standard python distribution.

You can also install it using sudo apt-get install python3-tk-dbg, if you are in virtualenv. (Same can be done for normal installation, not just virtualenv)

Khushhal
  • 645
  • 11
  • 18
2

to find your package run:

sudo yum search python|grep tk

mine was:

yum install python3-tkinter.x86_64

costamatrix
  • 670
  • 8
  • 17
2

On a MacBook use brew install python-tk

The error will be sorted out.

2

Windows

You may not have ticked tkinter during installation.

  • Download the latest version of python from python.org
  • Run the installer
  • Click modify
  • Select the Tk checkbox (and anything else you want)
  • And continue through the installation.

Done.

Stevo
  • 248
  • 4
  • 8
1

I was able to fix this on Amazon Linux 2 with python2.7 by running this sudo yum install python-tools -y command.

mellifluous
  • 2,345
  • 2
  • 29
  • 45
0

I had to install python3-tk manually before it worked (via apt-get)

0

the below answer in for Windows:

after installing Tk in your windows machine by following the instructions mentioned in the following link (https://tkdocs.com/tutorial/install.html#installwin), import tkinter as tk (for python3) or import Tkinter as tk (for python2). FYI - 'Tkinter' has been renamed as 'tkinter' in python3. It worked well for me.

Geetha
  • 9
  • 2
0

pip shown Could not find a version that satisfies the requirement python--tkinter (from versions: ) No matching distribution found for python--tkinter You are using pip version 10.0.1, however version 19.0.3 is available. You should consider upgrading via the python -m pip install --upgrade pip command.

LocoGris
  • 4,432
  • 3
  • 15
  • 30
0

import Tkinter as tk

Notice the T. This was changed in python 3.x

0

just go on cmd and type pip intall Tk interface, i thinks this is the full true name of tkinter module

0

I was running a Flask application in the almaLinux docker image and my fix for this was.

yum install python39* -y 
#Be aware this will install Everything including things you don't need. 

So this could be a simply case of you need to install the right package for the version of Python you are using.

Michael
  • 84
  • 4
0

T of Tkinter should be lowercase

Not

 import Tkinter as tk

Use as folow:

import tkinter as tk

or

from tkinter import * 
not : from Tkinter import * 
Hakan
  • 240
  • 3
  • 4