报错如下
(venv) venv☁ ai-video python main.py Traceback (most recent call last): File “/Users/jzh/Projects/ai-video/main.py”, line 1, in import customtkinter as ctk File “/Users/jzh/Projects/ai-video/venv/lib/python3.13/site-packages/customtkinter/init.py”, line 5, in from tkinter import Variable, StringVar, IntVar, DoubleVar, BooleanVar File “/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/tkinter/init.py”, line 38, in import _tkinter # If this fails your Python may not be configured for Tk ^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named ‘_tkinter’ (venv) venv☁ ai-video
解决方法
这是一个典型的 tkinter 安装问题。
在 macOS 上,我们需要安装 Python 的 Tkinter 支持。
brew install python-tk
如果上述命令不起作用,你也可以单独安装 tcl-tk:
brew install tcl-tk