解释器在尝试使用 tkinter 库时崩溃 [英] Interpreter crashes trying to use tkinter library

查看:34
本文介绍了解释器在尝试使用 tkinter 库时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试通过 Python3 在 VSCODE 中启动应用程序.
这是代码:

I have tried to staring the application in VSCODE by Python3.
This is the code:

from tkinter import *

window = Tk()
window.mainloop()

只有 3 行 :)),但是当我尝试在终端中执行该文件时,它会给我一个错误,您可以在下面看到.

only 3 lines :)), but when I'm trying to execute the file in terminal it will give me an error, which you can see below.

arash@Arash-MacBook-Pro tkinter % python3 main.py 
macOS 11 or later required !
zsh: abort ------ python3 main.py
arash@Arash-MacBook-Pro tkinter %

我的 Mac 在Big Sur"上工作过并有 Python3.9.

My Mac worked on "Big Sur" and has Python3.9.

推荐答案

这是 brew 安装 Python (来源).如果您直接通过官方安装程序此处安装 Python,则 tkinter 应该按预期工作.

This is an issue in the way brew installs Python (source). If you install Python directly via the official installer here then tkinter should work as expected.

这篇关于解释器在尝试使用 tkinter 库时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆