Reputation: 11590
My environment:
macOS 10.13 python 3.7.1 from Homebrew
I'm having lots of Tcl/TK quirks on the stock Tcl/TK 8.5 under /System/Library/Frameworks/Tcl.framework/Versions/8.5/
, and would like to upgrade my Tcl/TK.
But with this question I couldn't find any working tips for upgrading, including:
IDLE warns against an old TCL version even though I've installed a newer version
How do I link the ActiveState distribution of Tcl/Tk to HomeBrew installed Python
My test results
--with-tcl-tk
no longer works with the latest Homebrew. Running brew install python --with-tcl-tk
still points to system Tcl/TK 8.5.9.Upvotes: 4
Views: 8155
Reputation: 309
export PATH="$(brew --prefix tcl-tk)/bin:$PATH"
export LDFLAGS="-L$(brew --prefix tcl-tk)/lib"
export CPPFLAGS="-I$(brew --prefix tcl-tk)/include"
export PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig"
export CFLAGS="-I$(brew --prefix tcl-tk)/include"
Then reinstall your python using pyenv. All would work!
Upvotes: 0
Reputation: 1
This post provides a neat way:
https://stackoverflow.com/a/60469203/10606936
NOT NEEDED to use actviveTk or python.org python installation.
Keypoint is provide the correct ENV for installtion.
Upvotes: 0
Reputation: 11590
After many more failures, I concluded that the easiest way to make this work is to completely forget about Homebrew, uninstall its python packages.
Then install the latest ActiveTcl and then the python.org version instead. The python.org version will work on top of the latest "System" Tcl/TK, which will be refreshed after installing the ActiveTcl. Unfortunately, Homebrew ignores it.
The current 3.7.2 from python.org is compiled with Tcl/TK 8.6.8:
$ python3
Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter as tk
>>> print(tk.Tcl().eval('info patchlevel'))
8.6.8
After updating it, several bugs like checkbuttons showing wrong checkmarks on a menu disappeared.
Upvotes: 8