记录一次bug:manager_pyplot_show = vars(manager_class).get(“pyplot_show“) TypeError: vars() argument must

在pycharm中使用plot_2Dprojection_and_cardinality函数画图时,抛出异常:
manager_pyplot_show = vars(manager_class).get("pyplot_show") TypeError: vars() argument must have __dict__ attribute
解决方案1:

import matplotlib.pyplot as plt
import matplotlib as mpl
from imbens.utils._plot import plot_2Dprojection_and_cardinality

mpl.use('TkAgg')  # 手动添加该值,最后输出的图片是独立的图片,不在pychram工具栏中
print(mpl.get_backend())#不使用上面的代码时输出为:module://backend_interagg,使用后为TkAgg

fig = plot_2Dprojection_and_cardinality(X_train, y_train, figsize=(8, 4))
plt.show()

解决方案2:
进入pycharm设置Settings | Tools | Python Scientific | Show plots in tool window关闭它
关闭后print(mpl.get_backend()) 打印的值为 TkAgg
记录一次bug:manager_pyplot_show = vars(manager_class).get(“pyplot_show“) TypeError: vars() argument must_第1张图片

你可能感兴趣的:(bug,python,pycharm)