【发布时间】:2017-02-28 10:58:13
【问题描述】:
>>> import matplotlib.pyplot as plt
objc[19151]: Class TKApplication is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (0x107aab188) and /Users/rit/anaconda2/envs/mac_gdal/lib/libtk8.5.dylib (0x1117e0e40). One of the two will be used. Which one is undefined.
objc[19151]: Class TKMenu is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (0x107aab1d8) and /Users/rit/anaconda2/envs/mac_gdal/lib/libtk8.5.dylib (0x1117e2020). One of the two will be used. Which one is undefined.
objc[19151]: Class TKContentView is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (0x107aab228) and /Users/rit/anaconda2/envs/mac_gdal/lib/libtk8.5.dylib (0x1117e28a0). One of the two will be used. Which one is undefined.
objc[19151]: Class TKWindow is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (0x107aab278) and /Users/rit/anaconda2/envs/mac_gdal/lib/libtk8.5.dylib (0x1117e2da0). One of the two will be used. Which one is undefined.
导入 matplotlib 时如何解决此错误。我在 Mac Os X (Sierra) 上使用 python 2.7.12
【问题讨论】:
-
您的
tk安装存在问题,其中tk是双重安装的。删除其中一个tk安装,它应该可以工作。 -
这是在现有的 python 安装上安装 Anaconda 时的常见错误。
-
感谢@Eli,我在 .matplotlibrc 文件中添加了一个后端 TkAgg,我应该将其更改为其他内容吗?
-
您是否看过:stackoverflow.com/questions/35593602/… 或类似的问题(谷歌搜索 "Class TKApplication is implemented" 会给出很多类似的结果)?你都尝试了些什么?你试过 Eli 的建议了吗?
-
@Bart 此链接不包含答案!
sys.modules返回了两个Tk库,他有很多缺失点,python shell使用了default Tkinter但他从另一个模块调用Tkinter。 Terminal-Python Idle 是不同的东西。不要使用 python-idle 检查输出与matplotlib相关的 Tk 目录(在终端上)?永远不要删除重复的模块,可能包含另一个模块(可怕的想法)。import sys ; remove some duplicate module name on namespace
标签: python matplotlib