【发布时间】:2021-01-10 12:25:50
【问题描述】:
运行程序时出现此属性错误。我可以知道原因吗?
AttributeError: 部分初始化的模块“seaborn”没有属性“distplot”(很可能是由于循环导入)
这是我写的代码
from numpy import random
import matplotlib.pyplot as plt
import seaborn as sns
sns.displot(random.normal(size=1000), hist=False)
plt.show()
【问题讨论】:
-
完整的堆栈跟踪是什么?
-
docs 表明它已被弃用。这取决于您使用的版本
-
在你的问题中你写
distplot,但在代码中你写displot(没有t)。它们是相关但不同的功能。displot自 Seaborn 0.11 以来是新的,它也弃用了distplot。可能您正在运行旧版本的 Seaborn。
标签: python numpy matplotlib attributes seaborn