在尝试在OS X下安装scipy时,我临时安装了Anaconda,最终拥有了两个版本的Tk。为了解决这个问题,我将一些Tk或tkinter文件(比如_tkinter.so或类似的文件,嵌套在/System或/Library下)的原始版本移到了一个临时位置。我最终卸载了Anaconda,现在当我尝试导入turtle库时,例如,我得到了错误:
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/turtle.py", line 107, in <module>
import Tkinter as TK
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有人能告诉我如何恢复/重新安装随OS X安装的Tk的原始版本吗?
发布于 2017-09-30 15:45:18
进入你的终端并输入:
sudo apt-get python-tk如果这不起作用,你可以删除anaconda包,如下所示:
apt-get remove [anaconda]然后像这样重新安装Tkinter:
sudo apt-get python-tkhttps://stackoverflow.com/questions/37955929
复制相似问题