mac上TK Framework double implementation

来源:互联网 发布:高中网上听课软件 编辑:程序博客网 时间:2024/05/19 04:04

在mac上实验matplotlib相关功能的时候,发现报以下错误:

objc[5431]: Class TKApplication is implemented in both/Users/sykeoh/anaconda/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.objc[5431]: Class TKMenu is implemented in both /Users/sykeoh/anaconda/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.objc[5431]: Class TKContentView is implemented in both /Users/sykeoh/anaconda/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.objc[5431]: Class TKWindow is implemented in both /Users/sykeoh/anaconda/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.Segmentation fault: 11

问题应该是由anaconda安装包引起的。经过一番google,最终通过google在stack overflow上找着了答案:

cd ~/anaconda/lib/python3.5/lib-dynload$ install_name_tool -change "/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk" "@rpath/libtk8.5.dylib" _tkinter.so$ install_name_tool -change "/System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl" "@rpath/libtcl8.5.dylib" _tkinter.so

之前没有用过install_name_tool命令 ,顺便查一下这个命令的作用:
otoolinstall_name_tool 是 Xcode 自带的两个工具,提供了对库文件(.so,.dylib,etc..) 进行查看与修改的功能。完整的功能可以直接在 Terminal 运行查看。

参考文献:
1.http://stackoverflow.com/questions/35593602/tk-framework-double-implementation-issue 解决方案的stackoverflow,里面解释得很详细。
2.http://www.jianshu.com/p/193ba07dadcf install_name_tool的用法

0 0
原创粉丝点击