【问题标题】:Use no-X11 tkinter with python (installed through macports)将 no-X11 tkinter 与 python 一起使用(通过 macports 安装)
【发布时间】:2012-04-06 15:30:36
【问题描述】:

我已经安装了 Python 2.7 和一些有用的库(比如 Python Image Library) 通过 MacPorts。一切正常。

现在,我想使用 Tkinter。 问题是版本使用X11(我不想使用X11)。

如果我切换到 Apple 安装的 python (/usr/bin/python 而不是 /opt/local/bin/python),Tkinter 可以(不需要 X11)但是 当然,我错过了通过 MacPorts 安装的各种库。

我的问题是:“我如何在安装了 Python 2.7 的情况下使用 no X11 Tkinter 通过 MacPorts”?

提前致谢!

【问题讨论】:

  • 您是否尝试使用 +quartz 编译您的 macports Tk 以使用本机 OS X 图形而不是 X11?
  • 不...我只是做了类似的事情:port install tk
  • 好吧,这为 macports 添加了默认的 tk,即 X11 版本。试试 +aqua 版本(或者更好的 Cocoa 版本,但不确定它是否已经在 macports 中可用)。
  • 谢谢 schlenk。我尝试使用 +quartz(没有找到任何 +aqua 变体)。不再需要 X11,但我遇到了 tcl 的问题:TclMacOSXNotifierAddRunLoopMode: Tcl not built with CoreFoundation support 我没有找到任何 tcl 变体来获得支持 CoreFoundation 的 Tcl 版本。也许,fink 会是一个更好的选择?

标签: python macos tkinter macports


【解决方案1】:

tkinter 端口依赖于tk,但 tk 端口默认使用 x11 变体。通过安装石英变体来解决。 (先删除 tkinter 和 tk 端口,然后使用下面的命令安装 tk quartz 变体,然后再次安装 tkinter)

sudo port install tk -x11 +quartz

  • -x11 禁用默认的 x11 变体
  • +quartz 启用石英变体

关于变体的更多信息:https://guide.macports.org/#using.variants

【讨论】:

    【解决方案2】:

    这是一个已知问题,您可以查看此页面来解决它 https://www.python.org/download/mac/tcltk

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-15
      • 2023-03-30
      • 2011-11-22
      • 2015-12-28
      • 1970-01-01
      • 2015-12-18
      • 2011-11-22
      • 2011-06-26
      相关资源
      最近更新 更多