I am using python 3.9.1 on Mac OS 10.15.7 (Catalina). Python was installed with homebrew. When I import tkinter, I get version 8.5.9, and I want version 8.6 instead.
brew info tcl-tk
gives
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: [email protected] ✔
==> 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.
>>> 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.
What do I need to do?
EDIT
I tried adding the lines to my .bashrc file also, but that had no effect.
Apparently my python was outdated. (I never thought of that, since it was from last month.) Anyway,
brew update && brew upgrade [email protected]
fixed things.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With