4

On my Mac, I install python 3.9 via homebrew. I try to launch idle and get this error:

> idle3

** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **

MacOS: 11.4 Homebrew: 3.1.9-121-g654c78c Python: 3.9.5

user3153765
  • 373
  • 4
  • 14

2 Answers2

4

This is a Mac-only error, and as per @user3153765 's comment, running

brew install python-tk

will work as long as you have home-brew installed on your machine. If you do not have home-brew, check it out here! It is in my required reading list for all Mac-OS users.

If you decide, for some good reason that I have not thought of, not to use homebrew, you can also fix this with

sudo apt-get install python3-tk

if you have chosen to go the Ubuntu-based package manager route

Shep Sims
  • 698
  • 9
  • 27
0

Those who use MacPorts to manage their python modules can install tkinter with:

sudo port install py39-tkinter
weissj
  • 135
  • 1
  • 9
Ngoc Nguyen
  • 629
  • 4
  • 5