I am running MacOS Big Sur (11.2.3).

With python2, I have Tkinter built-in.

With python3, it has to be installed manually and it's very simple, just run:

$ brew install python-tk

To run python2 in a terminal, execute python file.py.

To run python3 in a terminal, execute python3 file.py.

Answer from sgon00 on Stack Overflow
🌐
Python GUIs
pythonguis.com › installation › install tkinter on macos
How to Install Tkinter on macOS — Python GUI Setup Guide
3 weeks ago - Homebrew has both Python 3 and Tkinter available in their repositories, making it the easiest way to get everything set up. ... This is also available to copy and paste from the Homebrew homepage. Once Homebrew is installed you can then install Python 3 with --
Discussions

How do I run the version of tkinter I brew installed instead of the system version?
tkinter is a standard library included with Python on macOS and Windows, so shouldn't need to be installed using homebrew - it does need to be installed for a lot of linux distributions though as the Python installation is often slimmed down. However, the macOS system installation of Python (no longer the out-of-support Python 2.7) has a buggy Apple-supplied Tcl/Tk 8.5 installation. This is what is imported with the -m switch. See https://www.python.org/download/mac/tcltk/ I prefer to install my own versions of Python using PyEnv (so I can have multiple versions available for testing). I also always use Python virtual environments on a project-by-project basis and don't install in any of the base environments provided by pyenv. When you create a script using import tkinter as tk, and attempt to run it with Python, what error message do you get? I suspect none as that will use a different version of the Tcl/Tk library. More on reddit.com
🌐 r/learnpython
7
1
September 2, 2022
python-tk@3.9: It's no longer possible to 'import tkinter' in a Python venv / virtualenv (but it works outside of virtualenv)
The brew doctor above contains no "Warning" lines. As a Python Tk GUI app developer I want to use the tkinter module from the Python 3.9 standard library. I follow a common practice and develop my Python code in a Python virtual environment. I was trying to run my Python code that has import tkinter lines within a Python virtual environment created using a Homebrew-installed ... More on github.com
🌐 github.com
7
March 26, 2021
brew install python --with-brewed-tk fails to make _tkinter.so
I tried to follow scicalculator's instructions to brew pymol # reset if necessary (only necessary if you previsouly installed tk,tcl, or python) brew uninstall python brew uninstall tk brew uni... More on github.com
🌐 github.com
27
March 22, 2013
python - How to install tkinter on M1 Mac - Stack Overflow
I'm trying to run app with Mac M1 Errors are: bash-3.2$ brew install tkinter ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae Updated 8 formulae. Warning: No More on stackoverflow.com
🌐 stackoverflow.com
🌐
Homebrew
formulae.brew.sh › formula › python-tk@3.9
python-tk@3.9 — Homebrew Formulae
Install command: brew install python-tk@3.9 · Python interface to Tcl/Tk · https://www.python.org/ License: Python-2.0 · Development: Pull requests · Formula JSON API: /api/formula/python-tk@3.9.json · Formula code: python-tk@3.9.rb on GitHub ·
🌐
GitHub
gist.github.com › txoof › 675e72d43f1bfbade04fdcec99ff4085
Setup python with tkinter under homebrew · GitHub
``` /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)" ``` ... env \ PATH="$(brew --prefix tcl-tk)/bin:$PATH" \ LDFLAGS="-L$(brew --prefix tcl-tk)/lib" \ CPPFLAGS="-I$(brew --prefix tcl-tk)/include" \ PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \ CFLAGS="-I$(brew --prefix tcl-tk)/include" \ PYTHON_CONFIGURE_OPTS="--enable-framework --with-tcltk-includes='-I$(brew --prefix tcl-tk)/include' --with-tcltk-libs='-L$(brew --prefix tcl-tk)/lib -ltcl8.6 -ltk8.6' " \ pyenv install 3.8.5
🌐
Reddit
reddit.com › r/learnpython › how do i run the version of tkinter i brew installed instead of the system version?
r/learnpython on Reddit: How do I run the version of tkinter I brew installed instead of the system version?
September 2, 2022 -

On MacOS 12.5 I have updated to the latest version of Python and pip and I just brew installed tkinter. When I do "python3 -m tkinter", I get the message: DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. - and the window that launches is buggy.

It seems like the command above is not running the version of tkinter I just installed with brew.

Why is that and how do I get rid of this deprecated system version?

Or in general what is the real issue here?

Thanks very much

🌐
Homebrew
formulae.brew.sh › formula › python-tk@3.12
python-tk@3.12 — Homebrew Formulae
Install command: brew install python-tk@3.12 · Python interface to Tcl/Tk · https://www.python.org/ License: Python-2.0 · Development: Pull requests · Formula JSON API: /api/formula/python-tk@3.12.json · Formula code: python-tk@3.12.rb ...
🌐
TkDocs
tkdocs.com › tutorial › install.html
TkDocs Tutorial - Installing Tk
Here, you have two good options: ... by Tkinter. Homebrew. If you already use Homebrew, you can install Tcl/Tk using the following command: % brew install tcl-tk ·...
🌐
Homebrew
formulae.brew.sh › formula › python-tk@3.10
python-tk@3.10 — Homebrew Formulae
Install command: brew install python-tk@3.10 · Python interface to Tcl/Tk · https://www.python.org/ License: Python-2.0 · Development: Pull requests · Formula JSON API: /api/formula/python-tk@3.10.json · Formula code: python-tk@3.10.rb ...
Find elsewhere
🌐
Homebrew
formulae.brew.sh › formula › python-tk@3.11
python-tk@3.11 — Homebrew Formulae
Install command: brew install python-tk@3.11 · Python interface to Tcl/Tk · https://www.python.org/ License: Python-2.0 · Development: Pull requests · Formula JSON API: /api/formula/python-tk@3.11.json · Formula code: python-tk@3.11.rb ...
🌐
DEV Community
dev.to › xshapira › using-tkinter-with-pyenv-a-simple-two-step-guide-hh5
Using tkinter with pyenv: A Simple Two-Step Guide - DEV Community
June 3, 2023 - brew install openssl readline sqlite3 xz zlib env LDFLAGS="-L$(brew --prefix openssl@1.1)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix sqlite3)/lib -L$(brew --prefix xz)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix tcl-tk)/lib" \ CPPFLAGS="-I$(brew --prefix openssl@1.1)/include -I$(brew --prefix readline)/include -I$(brew --prefix sqlite3)/include -I$(brew --prefix xz)/include -I$(brew --prefix zlib)/include -I$(brew --prefix tcl-tk)/include" \ PKG_CONFIG_PATH="$(brew --prefix openssl@1.1)/lib/pkgconfig:$(brew --prefix readline)/lib/pkgconfig:$(brew --prefix sqlite3)/lib/pkgconfig:$(brew --prefix xz)/lib/pkgconfig:$(brew --prefix zlib)/lib/pkgconfig:$(brew --prefix tcl-tk)/lib/pkgconfig" \ pyenv install <version> Replace <version> with the version of Python you want to install. After that, you should be able to import tkinter in your pyenv Python environment.
🌐
Peddals Blog
blog.peddals.com › ホーム › you may need to install tkinter separately if it’s gone.
You may need to install tkinter separately if it's gone. | Peddals Blog
January 3, 2024 - Aha! If I read the brew install log once completed, I didn’t need to waste 6 hours and would have a sweet dream. Anyways, if your tkinter is gone after upgrading Python by brew, just execute another command brew install [email protected] and install it as well.
🌐
GitHub
github.com › Homebrew › homebrew-core › issues › 73987
python-tk@3.9: It's no longer possible to 'import tkinter' in a Python venv / virtualenv (but it works outside of virtualenv) · Issue #73987 · Homebrew/homebrew-core
March 26, 2021 - I expected my Python file containing import tkinter to finish successfully with no output and exit code 0: ... $ brew install python-tk ==> Downloading https://homebrew.bintray.com/bottles/python-tk@3.9-3.9.2.big_sur.bottle.tar.gz Already ...
Author   vlasovskikh
🌐
Medium
xogk39.medium.com › install-tkinter-on-mac-pyenv-f112bd3f4663
Install tkinter on Mac. (pyenv). Install tcl-tk | by Taeha Hong | Medium
May 8, 2020 - ※ pyenv uninstall 3.6.9 ※ env \ PATH="$(brew --prefix tcl-tk)/bin:$PATH" \ LDFLAGS="-L$(brew --prefix tcl-tk)/lib" \ CPPFLAGS="-I$(brew --prefix tcl-tk)/include" \ PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \ CFLAGS="-I$(brew --prefix tcl-tk)/include" \ PYTHON_CONFIGURE_OPTS="--with-tcltk-includes='-I$(brew --prefix tcl-tk)/include' --with-tcltk-libs='-L$(brew --prefix tcl-tk)/lib -ltcl8.6 -ltk8.6'" \ pyenv install 3.6.9 ... >>> import tkinter >>> tkinter.TclVersion, tkinter.TkVersion (8.6, 8.6) >>> tkinter._test() # You should get a GUI
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-install-tkinter-on-macos
How to Install Tkinter on MacOS? - GeeksforGeeks
July 23, 2025 - Follow the below steps to install the Tkinter package on macOS using pip:
🌐
GitHub
github.com › Homebrew › legacy-homebrew › issues › 18657
brew install python --with-brewed-tk fails to make _tkinter.so · Issue #18657 · Homebrew/legacy-homebrew
March 22, 2013 - -IInclude -I./Include -I/usr/local/include -I/private/tmp/python-t7EK/Python-2.7.3/Include -I/private/tmp/python-t7EK/Python-2.7.3 -c /private/tmp/python-t7EK/Python-2.7.3/Modules/_tkinter.c -o build/temp.macosx-10.8-x86_64-2.7/private/tmp/python-t7EK/Python-2.7.3/Modules/_tkinter.o brew: superenv removed: -I/usr/local/include -g -O3 -Wall -Wstrict-prototypes -I./Include -I/usr/local/include -I/private/tmp/python-t7EK/Python-2.7.3/Include -I/private/tmp/python-t7EK/Python-2.7.3 cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DWITH_APPINIT=1 -I/usr/X11R6/include -I/private/tmp/python-t7EK/Python-2.7.3/Mac/Include -I.
Author   telamonian
🌐
Homebrew
formulae.brew.sh › formula › python-tk@3.13
python-tk@3.13 — Homebrew Formulae
Install command: brew install python-tk@3.13 · Python interface to Tcl/Tk · https://www.python.org/ License: Python-2.0 · Development: Pull requests · Formula JSON API: /api/formula/python-tk@3.13.json · Formula code: python-tk@3.13.rb ...
Top answer
1 of 4
6

Here is step by step guide to make IDLE and tkinter work:

  1. install tcl-tk with Homebrew. In shell run brew install tcl-tk
  2. in shell run echo 'export PATH="/usr/local/opt/tcl-tk/bin:$PATH"' >> ~/.zshrc
  3. reload shell by quitting Terminal app or run source ~/.zshrc
  4. after reloaded check that tck-tk is in $PATH. Run echo $PATH | grep --color=auto tcl-tk. As the result you should see your $PATH contents with tcl-tk highlighted
  5. now we run three commands from Homebrew's output from step #1
    1. in shell run export LDFLAGS="-L/usr/local/opt/tcl-tk/lib"
    2. in shell run export CPPFLAGS="-I/usr/local/opt/tcl-tk/include"
    3. in shell run export PKG_CONFIG_PATH="/usr/local/opt/tcl-tk/lib/pkgconfig"
  6. if you have your Python version already installed with pyenv then uninstall it with pyenv uninstall <your python version>. E.g. pyenv uninstall 3.8.2
  7. set environment variable that will be used by python-build. In shell run PYTHON_CONFIGURE_OPTS="--with-tcltk-includes='-I/usr/local/opt/tcl-tk/include' --with-tcltk-libs='-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6'" Note: in future use tck-tk version that actually installed with Homebrew. At the moment of posting 8.6 was the actual
  8. finally install Python with pyenv with pyenv install <version>. E.g. pyenv install 3.8.2

Test

  1. in shell run pyenv global <verion that you've just installed>
  2. now check IDLE. In shell run idle. You should see IDLE window without any warnings and "text printed in red".

  1. now check tkinter. In shell run python -m tkinter -c "tkinter._test()". You should see test window like on the image:

That's it!

My environment:

check this is something went wrong executing steps above:

  1. macOS Catalina
  2. zsh (included in macOS Catalina) = "shell" above
  3. Homebrew (installed with instructions from Homebrew official website)
  4. pyenv (installed with Homebrew and PATH updated according to pyenv official readme from GitHub)
  5. Python 3.8.x - 3.9.x (installed with pyenv install <version> command)
2 of 4
4

I never got this to work. I spent a ton of time on this page as well as a number of other sites, and tried everything. It seems that Homebrew Python and Tcl-Tk are at this time not out of the box the same version, and it's a common issue. What I did end up doing was to install both pyenv and anaconda side by side as per the excellent instructions of @Simba here, and using Anaconda my Tcl-Tk commands are working fine. Posting here so that others don't fall down this rabbit hole, or if they do and find a solution, it would be wonderful to know.

🌐
Homebrew
discourse.brew.sh › t › python3-installation-with-tkinter › 3636
Python3 installation with tkinter - Homebrew
December 13, 2018 - I’m trying to use a package that depends on tkinter in python, and can’t get it to work. I run into the error “_tkinter” not found, and a suggestion my installation might not have been configured to use tkinter. This stackoverflow post suggested I should use the flags --with-tcl-tk, ...