Modulenotfounderror tkinter

[Windows 11]

I am trying to run some code which uses the tkinter library and I got the modulenotfounderror. So I assumed I had not installed tkinter during the Python installation and so reinstalled the latest stable version of python (3.12.3). Note- I previously had (3.11.1) installed on my laptop.

Interestingly, after launching downloading the python installer, launching it and all my python version is still (3.11.1) and I still can’t seem to execute code using tkinter libraries. I have added python to the environmental variables and made sure to check the tk/tcl this time.

Have you tried using the py command (available only on Windows)?

It should also be possible to “Repair” the 3.11 installation to re-run the installer and add Tkinter to it.

More general advice: