简体   繁体   English

在 macOS 上更新 Homebrew python3 的 tcl/tk 版本

[英]Updating tcl/tk version of Homebrew python3 on macOS

My environment:我的环境:

macOS 10.13 python 3.7.1 from Homebrew来自 Homebrew 的 macOS 10.13 python 3.7.1

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.我在/System/Library/Frameworks/Tcl.framework/Versions/8.5/下的库存 Tcl/TK 8.5 上有很多 Tcl/TK 怪癖,并且想升级我的 Tcl/TK。

But with this question I couldn't find any working tips for upgrading, including:但是有了这个问题,我找不到任何升级的工作提示,包括:

My test results我的测试结果

  1. --with-tcl-tk no longer works with the latest Homebrew. --with-tcl-tk不再适用于最新的 Homebrew。 Running brew install python --with-tcl-tk still points to system Tcl/TK 8.5.9.运行brew install python --with-tcl-tk仍然指向系统 Tcl/TK 8.5.9。
  2. The above is also tested with an uninstall/install cycle.以上内容也通过卸载/安装周期进行了测试。
  3. Python keeps using system Tcl/TK after installing latest ActiveTcl.安装最新的 ActiveTcl 后,Python 继续使用系统 Tcl/TK。

After many more failures, I concluded that the easiest way to make this work is to completely forget about Homebrew, uninstall its python packages.在多次失败之后,我得出结论,使这项工作最简单的方法是完全忘记 Homebrew,卸载其 python 包。

Then install the latest ActiveTcl and then the python.org version instead.然后安装最新的 ActiveTcl,然后安装 python.org 版本。 The python.org version will work on top of the latest "System" Tcl/TK, which will be refreshed after installing the ActiveTcl. python.org 版本将在最新的“系统”Tcl/TK 之上工作,安装 ActiveTcl 后将刷新。 Unfortunately, Homebrew ignores it.不幸的是,Homebrew 忽略了它。

The current 3.7.2 from python.org is compiled with Tcl/TK 8.6.8:来自 python.org 的当前 3.7.2 是用 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.更新后,一些错误,例如在菜单上显示错误复选标记的复选按钮消失了。

This post provides a neat way:这篇文章提供了一种简洁的方法:

https://stackoverflow.com/a/60469203/10606936 https://stackoverflow.com/a/60469203/10606936

NOT NEEDED to use actviveTk or python.org python installation.不需要使用 activetk 或 python.org python 安装。

Keypoint is provide the correct ENV for installtion. Keypoint 是为安装提供正确的 ENV。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM