弃用警告:TK的系统版本已弃用,M1 Mac在VS代码中 - 全局Python
(M1 MBA 2020,MACOS 12.3.1) 因此,在VS代码中,当我从我的usr/local/local/bin tkinter
中选择解释器为Python 3.8.9
时,它会按照我的要求运行。
这是用于参考的运行代码。
当我尝试使用全局python 3.8.9
interneter(usr/bin/python3
)时,出现了问题。当代码运行时,应用程序最终看起来像这样。
另外,当我运行代码时,终端读取以下内容:
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
我如何解决此错误?或更新我的全局TKINTER版本而不会偏离Python 3.8.9
。此外,如果需要更多信息,我会很乐意提供,对不起,我是
该应用中使用的这些包装的新手: tkinter,枕头,tkmacosx
最后一件事,当我摆脱所有包装tkmacosx的提及时,该应用看起来像这样:
(M1 MBA 2020, MacOS 12.3.1)
So inside of Vs Code, when I select my interpreter as Python 3.8.9
from my usr/local/bin Tkinter
it runs as I want it to.
Here is the running code for reference.
The problem arises when I am trying to use the Global Python 3.8.9
interpreter (usr/bin/python3
). When the code runs, the application ends up looking like this.
Additionally, when I run the code the terminal reads the following:
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
How is it possible for me to fix this error? Or update my global Tkinter version without straying away from Python 3.8.9
. Furthermore if any more info is needed I'll be happy to provide, sorry I'm new to this stuff ????
Packages used in the app:
tkinter, Pillow, tkmacosx
One last thing, when I get rid of all mentions of the package Tkmacosx, the app appears like this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您安装了自制的
tk
,则可以使用以下方式更新tk
。
/tcl-tk/bin:$ path“ to
.zshrc
file:如果您使用
zsh
终端:of
或者,如果您使用的是
bash
终端:如果以上步骤不起作用,则您 May 需要安装另一个软件包(@goker):
If you have Homebrew installed, you can update
tk
with:Which is the recommended option
Then you may need to add
export PATH="/usr/local/opt/tcl-tk/bin:$PATH"
to your.zshrc
file:If you are using a
zsh
terminal:Use:
Or if you are using a
bash
terminal:If the steps above didn't work, you may need to install another package (@goker):
https://stackoverflow.com/a/72472483/9842697 的答案。
(此注释是对答案的回应)
我已经通过Pyenv安装了Python 3.10.6,Pyenv通过Homebrew安装了Pyenv。
(使用-Devel不起作用的卸载)
Answer from Freddy below https://stackoverflow.com/a/72472483/9842697 worked.
(this note was to be a response to the answer)
I have python 3.10.6 installed via pyenv, pyenv installed via homebrew.
(Uninstall with --devel does not work)