0

I was using tkinter all fine but one day I turned on my pc and just stopped working.

I use python 3.9.10 windows

code:

from tkinter import *
from tkinter.ttk import *

terminal:

   from tkinter import *
  File "C:\Users\rotok\AppData\Local\Programs\Python\Python39-32\lib\tkinter\__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
FUSHI
  • 19
  • 5
  • _import _tkinter # If this fails your Python may not be configured for Tk_ did you read this? what did you conclude from that? have you tried searching for that specific issue? – Matiiss Mar 19 '22 at 00:14
  • Does this answer your question? [Tkinter: "Python may not be configured for Tk"](https://stackoverflow.com/questions/5459444/tkinter-python-may-not-be-configured-for-tk) – Matiiss Mar 19 '22 at 00:15
  • @Matiiss I tried import _tkinter and did not work I searched and I found that i need to reinstall tk but didn't work too . should i reinstall python or download other version of python? – FUSHI Mar 19 '22 at 00:42
  • "I was using tkinter all fine but one day I turned on my pc and just stopped working." - because this was the first time that you tried to use the 3.9 install of Python on your computer to run Tkinter code. The 3.8 install worked, as you say. Each installation must have its own Tkinter support - on Windows, this is set up by the installer, when you install each Python (or "repair" the installation). Please see the linked duplicate for details. – Karl Knechtel Apr 30 '23 at 00:14

2 Answers2

1

First You can try reinstalling it by using these codes:

pip install -I pip install --ignore-installed

If it won't work reinstall pip by using this code:

python -m pip install --upgrade --force-reinstall pip

and then try - pip install tkinter

I hope it solves your doubt...

nothing
  • 102
  • 7
  • no it doesn't work i will try to download python 3.8.1 and try because I heard it's good – FUSHI Mar 19 '22 at 22:48
0

I simply changed python version and now it's working fine.

I use now python 3.8.1

FUSHI
  • 19
  • 5