ImportError:No module named 'Tkinter'
For some reason, I can't use the Tkinter
or tkinter
module. After running the following command in the python shell
import Tkinter
or
import tkinter
I got this error
ModuleNotFoundError: No module named 'Tkinter'
or
ModuleNotFoundError: No module named 'tkinter'
What could be the reason for and how can we solve it?
If you're using python 3.9 on Mac, you can simply install tkinter
using brew:
brew install python-tk@3.9
This fixed it for me.
Edit:
As mentioned by others, you can also use the general command to install the latest version:
brew install python-tk
欢迎关注我公众号:AI悦创,有更多更好玩的等你发现!
公众号:AI悦创【二维码】

AI悦创·编程一对一
AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发、Linux、」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然,还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线,随时响应!微信:Jiabcdefh
C++ 信息奥赛题解,长期更新!长期招收一对一中小学信息奥赛集训,莆田、厦门地区有机会线下上门,其他地区线上。微信:Jiabcdefh
方法一:QQ
方法二:微信:Jiabcdefh
