Search code examples
pythonpython-3.xpython-3.9

ModuleNotFoundError: No module named '_tkinter' in python3?


I am newbie , I write 5 line of tkinter but it not runs giving error that

Traceback (most recent call last):
  File "/Users/pathparakh/Projects/python/tk/hello.py", line 1, in <module>
    from _tkinter import *
ModuleNotFoundError: No module named '_tkinter'

my code is

from tkinter import *

root = Tk()
hi = Label(root, text='hi').pack()
root.mainloop()

but before 5 hour it runs properly.


Solution

  • I successfully fixed this problem by running the following command:

    brew install [email protected]