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
🌐
Homebrew
formulae.brew.sh › formula › python-tk@3.12
python-tk@3.12 — Homebrew Formulae
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 on GitHub ·
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 - 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
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
🌐
Homebrew
formulae.brew.sh › formula › python-tk@3.11
python-tk@3.11 — Homebrew Formulae
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 on GitHub ·
🌐
Homebrew
formulae.brew.sh › formula › python-tk@3.9
python-tk@3.9 — Homebrew Formulae
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
🌐
Homebrew
formulae.brew.sh › formula › python-tk@3.10
python-tk@3.10 — Homebrew Formulae
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 on GitHub · Bottle ...
🌐
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 --
Find elsewhere
🌐
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.13
python-tk@3.13 — Homebrew Formulae
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 on GitHub ·
🌐
Homebrew
formulae.brew.sh › formula › python-tk@3.14
python-tk@3.14 — Homebrew Formulae
brew install python-tk@3.14 · Also known as: python-tk · Python interface to Tcl/Tk · https://www.python.org/ License: Python-2.0 · Development: Pull requests · Formula JSON API: /api/formula/python-tk@3.14.json · Formula code: ...
🌐
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 - sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ xz-utils tk-dev libffi-dev liblzma-dev python-openssl git env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install <version> ... 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 --prefi
🌐
GitHub
gist.github.com › iexa › 2ac761bfd96ab78988b76c030d54a5b8
MacOS homebrew python 3.8.6 with tcl-tk (properly) · GitHub
Now tkinter is newly in python-tk formula. If you fail to execute tkinter, just run brew update && brew install python-tk .
🌐
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.
🌐
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 ... --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...
🌐
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 - python-tk@3.9: It's no longer possible to 'import tkinter' in a Python venv / virtualenv (but it works outside of virtualenv)#73987 ... bugReproducible Homebrew/homebrew-core bugReproducible Homebrew/homebrew-core bugoutdatedPR was locked due to agePR was locked due to age ... $ brew config HOMEBREW_VERSION: 3.0.9 ORIGIN: https://github.com/Homebrew/brew HEAD: ed87211daa83982a6136e14d181a1550b46a0f17 Last commit: 3 days ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: 95b3f0a3d374ce5168c7775ed2b0c980d7441901 Core tap last commit: 42 minutes ago Core tap branch: mas
Author   vlasovskikh
🌐
Ministry of Intrigue
andrlik.org › dispatches › til-tkinter-on-m2-mac
TIL - Getting asdf Python with tkinter working on a M2 Mac · Ministry of Intrigue
June 30, 2023 - brew install pkg-config # Brew output ... asdf uninstall python 3.11.4 asdf reshim python PYTHON_CONFIGURE_OPTS="--with-tcltk-includes='$(pkg-config tk --cflags)' --with-tcltk-libs='$(pkg-config tk --libs)'" asdf install python 3.11.4
🌐
TkDocs
tkdocs.com › tutorial › install.html
TkDocs Tutorial - Installing Tk
You can check this via brew info ruby. Below, where we use gem or irb, make sure you're running the version you just installed. One way to do that is specifying the full path. Next, you'll need to download and install Ruby's Tk module, which is packaged as a Ruby gem.
🌐
Codidact
software.codidact.com › posts › 291791
Why does `tkinter` (or `turtle`, or IDLE) seem to be missing or broken? Isn't it part of the standard library? - Software Development
Simply "repair" the installation and make sure to check the option to include this. Use brew install python-tk; if necessary, specify a Python version like brew install [email protected].
🌐
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 - # reset if necessary (only necessary if you previsouly installed tk,tcl, or python) brew uninstall python brew uninstall tk brew uninstall tcl # get tk and tcl with threads enabled brew tap homebrew/dupes brew install tk --enable-threads # install python linked to the above tk installation brew install python --with-brewed-tk # don't have pmw yet?
Author   telamonian