我使用的是anaconda python包,它是为tkinter配置的。
我安装了ActiveTcl,接下来 https://www.python.org/download/mac/tcltk/ 我能够很好地导入其他库,运行ipython等。不是python3中的tkinter或python2中的Tkinter。 当我尝试导入tkinter时,我收到以下消息:
Python 3.3.1 |Anaconda 1.5.1 (x86_64)| (default, Apr 25 2013, 23:10:48)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/username/anaconda/envs/py3k/lib/python3.3/tkinter/__init__.py", line 40, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: dlopen(/Users/username/anaconda/envs/py3k/lib/python3.3/lib-dynload/_tkinter.so, 2): Library not loaded: /usr/X11/lib/libX11.6.dylib
Referenced from: /Users/username/anaconda/lib/libtk8.5.dylib
Reason: image not found