我在Mac上通过自制软件安装了我的Python.
brew install python
Run Code Online (Sandbox Code Playgroud)
之后我将我的python版本检查为2.7.11,然后我尝试了执行
import Tkinter
Run Code Online (Sandbox Code Playgroud)
我有以下错误消息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
Run Code Online (Sandbox Code Playgroud) 我的环境:
来自 Homebrew 的 macOS 10.13 python 3.7.1
我有很多关于 Tcl/TK 8.5 下的 Tcl/TK 怪癖,/System/Library/Frameworks/Tcl.framework/Versions/8.5/我想升级我的 Tcl/TK。
但是有了这个问题,我找不到任何升级的工作提示,包括:
我的测试结果
--with-tcl-tk不再适用于最新的 Homebrew。运行brew install python --with-tcl-tk仍然指向系统 Tcl/TK 8.5.9。