Interpreter crashes trying to use tkinter library

Viewed 3579

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

from tkinter import *

window = Tk()
window.mainloop()

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 %

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

2 Answers

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.

If you installed python using brew you can also use the following command to install the missing package:

brew install python-tk@3.9
Related