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

标签 python tkinter tcltk

我的环境:

macOS 10.13 来自 Homebrew 的 python 3.7.1

我在 /System/Library/Frameworks/Tcl.framework/Versions/8.5/ 下的库存 Tcl/TK 8.5 上有很多 Tcl/TK 怪癖,我想升级我的Tcl/TK.

但是带着这个问题我找不到任何升级的工作技巧,包括:

我的测试结果

  1. --with-tcl-tk 不再适用于最新的 Homebrew。运行 brew install python --with-tcl-tk 仍然指向系统 Tcl/TK 8.5.9。
  2. 以上内容还通过卸载/安装循环进行了测试。
  3. Python 在安装最新的 ActiveTcl 后继续使用系统 Tcl/TK。

最佳答案

在多次失败之后,我得出结论,使这项工作最简单的方法是完全忘记 Homebrew,卸载它的 python 包。

然后安装最新的 ActiveTcl,然后安装 python.org 版本。 python.org 版本将在最新的“系统”Tcl/TK 之上运行,它将在安装 ActiveTcl 后刷新。不幸的是,Homebrew 忽略了它。

当前来自 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

更新后,一些错误(如复选按钮在菜单上显示错误的复选标记)消失了。

关于python - 在 macOS 上更新 Homebrew python3 的 tcl/tk 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53930597/

相关文章:

python - 单击时禁用/启用 Tkinter 按钮

Python 方法奇怪地暂停,直到 tkinter root 关闭

python - 有没有办法在 macOS Big Sur 上使用 SageMath?

python - Tkinter/ttk 帧大小

python - 如何连续收听DDE数据

尽管系统上有可用的 tcl-tk,但 R 包 geoR 不会安装在 macOS 上

python - 按下一个键时只增加一个

python - 类型错误 : hp_choice() takes 2 positional arguments but 7 were given

python - 在python中查询mysql数据库,其中表是一个变量