简体   繁体   English

python 不使用 tkinter 8.6 与 Mac 上的自制软件一起安装

[英]python not using tkinter 8.6 installed with homebrew on Mac

I am using python 3.9.1 on Mac OS 10.15.7 (Catalina).我在 Mac OS 10.15.7 (Catalina) 上使用 python 3.9.1。 Python was installed with homebrew. Python 安装了自制软件。 When I import tkinter, I get version 8.5.9, and I want version 8.6 instead.当我导入 tkinter 时,我得到版本 8.5.9,而我想要版本 8.6。

brew info tcl-tk gives brew info tcl-tk给出

tcl-tk: stable 8.6.10 (bottled) [keg-only]
Tool Command Language
https://www.tcl-lang.org
/usr/local/Cellar/tcl-tk/8.6.10 (3,022 files, 50.9MB)
  Poured from bottle on 2020-03-10 at 17:57:25
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/tcl-tk.rb
License: TCL
==> Dependencies
Required: openssl@1.1 ✔
==> Caveats
tcl-tk is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have tcl-tk first in your PATH run:
  echo 'export PATH="/usr/local/opt/tcl-tk/bin:$PATH"' >> /Users/saul/.bash_profile

For compilers to find tcl-tk you may need to set:
  export LDFLAGS="-L/usr/local/opt/tcl-tk/lib"
  export CPPFLAGS="-I/usr/local/opt/tcl-tk/include"

For pkg-config to find tcl-tk you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/tcl-tk/lib/pkgconfig"

==> Analytics
install: 362,394 (30 days), 390,184 (90 days), 474,512 (365 days)
install-on-request: 9,609 (30 days), 17,845 (90 days), 60,715 (365 days)
build-error: 0 (30 days)

I put the suggested lines in my bash_profile but they don't seem to have had any effect.我将建议的行放在我的bash_profile中,但它们似乎没有任何效果。

>>> import tkinter
>>> tcl = tkinter.Tcl()
>>> print(tcl.call("info", "patchlevel"))
8.5.9

I found a lot of stuff about this issue online, but it all seemed to be related to pyenv, which I don't use, and I couldn't pick out anything other than what's described above that seemed to related to my situation.我在网上找到了很多关于这个问题的东西,但似乎都与我不使用的 pyenv 有关,除了上面描述的似乎与我的情况有关的东西之外,我找不到任何东西。

What do I need to do?我需要做什么?

EDIT编辑

I tried adding the lines to my.bashrc file also, but that had no effect.我也尝试将这些行添加到 my.bashrc 文件中,但这没有效果。

Apparently my python was outdated.显然我的 python 已经过时了。 (I never thought of that, since it was from last month.) Anyway, (我从没想过,因为它是从上个月开始的。)无论如何,

brew update && brew upgrade python@3.9

fixed things.固定的东西。

Brew itself provided solution with python 3.9. Brew 本身提供了 python 3.9 的解决方案。 You just have to install separate package:您只需要安装单独的 package:

brew install python-tk@3.9

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

相关问题 Mac没有找到Homebrew安装的Python - Mac Not Finding Homebrew Installed Python 自制软件:安装了错误python版本(mac)的软件包 - Homebrew: Packages are installed for wrong python version (mac) [mac Monterey][Python 3.10.4][tkinter 8.6] 重复创建 window 时调用 tkinter askOpenfilename 崩溃 - [mac Monterey][Python 3.10.4][tkinter 8.6] Calling tkinter askOpenfilename crashes when repeatedly creating a window 为什么通过 Homebrew 安装的 Python 不包括 Tkinter - Why does Python installed via Homebrew not include Tkinter 在Mac上以自制软件安装的python的My Idle(idle3)崩溃 - My Idle (idle3) from python installed with homebrew on a mac crashes 如果通过自制软件安装了 python 和 pygame,那么 mac 上的 pygame 文件夹在哪里? - Where is pygame folder on mac if installed python and pygame via homebrew? 如何让 Mac OS 使用 Homebrew 安装的 python - How to make Mac OS use the python installed by Homebrew 使用Homebrew和pyenv在Mac上安装OpenCV 3 for Python 3 - Installing OpenCV 3 for Python 3 on a mac using Homebrew and pyenv 在Mac Sierra上随带自制软件安装的virtualenvwrapper的错误消息 - Error message for virtualenvwrapper installed with homebrew on Mac Sierra 如何在 Mac 上卸载 pyenv(由自制软件安装) - how to uninstall pyenv(installed by homebrew) on Mac
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM