Tkinter不起作用,它抛出一个错误。
安装:
% pip3 install tk
我的代码:
#!/usr/bin/env python3
import tkinter as tk
错误:
Traceback (most recent call last):
File "/Users/arghadip/Library/Application Support/CodeRunner/Unsaved/Untitled.py", line 4, in <module>
import tkinter as tk
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py", line 37, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
_tkinter
, so your python might not be configured fortkinter
- user15801675brew install python-tk
尝试。 - user15801675pip3 install tk
是什么吗? - user15242190