'I can't install Tkinter or tkinter. I tried every code and reinstall TCL/TK too. But still got an error
I try every solution on stackover and many other sites. But it's still giving same faults. I even couldn't install it.
C:\Users\***\Google Drive\Python>pip install tkinter
Collecting tkinter
Could not find a version that satisfies the requirement tkinter (from versions: )
No matching distribution found for tkinter
C:\Users\***\Google Drive\Python>pip install Tkinter
Collecting Tkinter
Could not find a version that satisfies the requirement Tkinter (from versions: )
No matching distribution found for Tkinter
C:\Users\***\Google Drive\Python>pip install Tk
Collecting Tk
Could not find a version that satisfies the requirement Tk (from versions: )
No matching distribution found for Tk
C:\Users\***\Google Drive\Python>pip install tk
Collecting tk
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'Varolan bir bağlantı uzaktaki bir ana bilgisayar tarafından zorla kapatıldı', None, 10054, None))': /simple/tk/
Could not find a version that satisfies the requirement tk (from versions: )
No matching distribution found for tk
C:\Users\***\Google Drive\Python>pip install python3-tk
Collecting python3-tk
Could not find a version that satisfies the requirement python3-tk (from versions: )
No matching distribution found for python3-tk
Solution 1:[1]
It looks like you are on Windows, in which case you have tkinter already (if you run 2.7 or above). It seems you use Python 3 so run import tkinter. See the documentation
If you are on Linux/Mac/similar variant then you need to run sudo apt-get install python3-tk. It is not a pip package and cannot be installed in this way.
If the python -m tkinter command fails on Windows then your installation is broken, or if on Linux/Mac/Similar then the command above should work.
On Windows there are two things that could have gone wrong:
- Your installation is broken
- You forgot to check option for tkinter
If your installation is broken then reinstalling your should work, but more likely you forgot to check the tck/tk and IDLE option when installing. To check or to install re-run your installer and press modify. You should see a box like the following. Ensure then the tck/tk and IDLE does have a tick on it:
And press Next
Solution 2:[2]
So, as a user on Windows 10, I've mainly stuck to using just good ol' IDLE ... I must've gotten bored this weekend and for some crazy reason, decided to download and install Visual Studio. Obviously, being unfamiliar with it, I ran into some difficulties and confusion - one of them being VS insisting on using IT'S python environment rather than the more updated and latest one I already have installed.
This would be fine, especially since I could add only the packages that I needed to import, however... Visual Studio runs into the same issue described here. No form or fashion of attempting to install tkinter works ... python3-tk or otherwise.
I HAVE, however, worked around the issue in my particular case ... by adding the IDLE installation I already had to the Visual Studio Python environments. Apparently this only worked because IDLE Python installs tkinter as part of it's standard library.
I'm still curious and would like to know what needs to be done for non - IDLE installations, though... I didn't realize how big of a hassle this was before now. The most promising answer I could find leads to the Tcl developers:
https://www.activestate.com/products/tcl/
It appears as though it may require manual installation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | TrexxæByte |

