You can find a lot about this error on internet, but most often they are the simplest answers using package manager to install the missing module. But it’s not always the solution.

Firstly, why do you need tkinter? Do you create or use graphic interfaces?

In my case after the use of another library I got this error in my python 3.9.7 virtual environment. But after having a look to what is tkinter I realized that there is a bad import because I don’t have graphical interfaces.

After digging in my last source code changements I found a graphical import (turtle library, maybe it’s my IDE that quietly added? I don’t know…).

And then after removing this everything was OK.

Secondly, you really need tkinter but your python installation don’t have it and your python installation was created by python source code compilation?

This case is interesting because most of poeple give a simple solution like yum install python<version>-tk, … (or even pip install tk).

But it won’t work if your package manager doesn’t find a repository to download it. And especially because you’ve compiled yourself your python source code.
The solution? Install tk dependencies and recompile your python source code.

$> yum install tk-dev tcl-dev

Now compile again python source code.
And if your python application is executed inside a virtual environment using this python version, recreate the virtual environment after the python source code has been compiled.