我尝试使用Canopy导入 Tk 失败:
In [1]: import Tkinter
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-a0c812564da3> in <module>()
----> 1 import Tkinter
/Applications/Canopy.app/appdata/canopy-1.0.0.1160.macosx-x86_64/Canopy.app/Contents/lib/python2.7/lib-tk/Tkinter.py
in <module>()
37 # Attempt to configure Tcl/Tk without requiring PATH
38 import FixTk
---> 39 import _tkinter # If this fails your Python may not be configured for Tk
40 tkinter = _tkinter # b/w compat for export
41 TclError = _tkinter.TclError
ImportError: dlopen(/Applications/Canopy.app/appdata/canopy-1.0.0.1160.macosx-x86_64/Canopy.app/Contents/lib/python2.7/lib-dynload/_tkinter.so,
2): Library not loaded:
/Library/Frameworks/Python.framework/Versions/111.222.33344/lib/libtcl8.5.dylib
Referenced from:
/Applications/Canopy.app/appdata/canopy-1.0.0.1160.macosx-x86_64/Canopy.app/Contents/lib/python2.7/lib-dynload/_tkinter.so
Reason: image not found
和:
$ ls -l /Applications/Canopy.app/appdata/canopy-1.0.0.1160.macosx-x86_64/Canopy.app/Contents/lib/python2.7/lib-dynload/_tkinter.so
-rwxr-xr-x@ 1 cassio admin 66184 Mar 25 17:54
/Applications/Canopy.app/appdata/canopy-1.0.0.1160.macosx-x86_64/Canopy.app/Contents/lib/python2.7/lib-dynload/_tkinter.so
$ ls -l /Library/Frameworks/Python.framework/Versions/111.222.33344/lib/libtcl8.5.dylib
ls: /Library/Frameworks/Python.framework/Versions/111.222.33344/lib/libtcl8.5.dylib:
No such file or directory
我以为 Tk/Tcl 预装了 python。我怎样才能让它工作?