Python seaborn AttributeError:&x27;模块';对象没有属性';设置';

Python seaborn AttributeError:&x27;模块';对象没有属性';设置';,python,seaborn,Python,Seaborn,我在windows10中安装了anaconda2,并通过以下命令安装seaborn: conda install seaborn 然后我从seaborn网站下载了一个示例: import seaborn as sns sns.set(style="ticks") # Load the example dataset for Anscombe's quartet df = sns.load_dataset("anscombe") # Show the results of a linear

我在windows10中安装了anaconda2,并通过以下命令安装seaborn:

conda install seaborn
然后我从seaborn网站下载了一个示例:

import seaborn as sns
sns.set(style="ticks")

# Load the example dataset for Anscombe's quartet
df = sns.load_dataset("anscombe")

# Show the results of a linear regression within each dataset
sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data=df,
       col_wrap=2, ci=None, palette="muted", size=4,
       scatter_kws={"s": 50, "alpha": 1})
在命令提示符下运行示例后,它抛出以下错误:

Traceback (most recent call last):
  File "seaborn.py", line 1, in <module>
    import seaborn as sns
  File "E:\OneDrive\seek_backward\caiwufenxi\source\seaborn.py", line 5, in   <module>
  df = sns.load_dataset("anscombe")
AttributeError: 'module' object has no attribute 'load_dataset'
回溯(最近一次呼叫最后一次):
文件“seaborn.py”,第1行,在
导入seaborn作为sns
文件“E:\OneDrive\seek\u backward\caiwufenxi\source\seaborn.py”,第5行,在
df=sns.load_数据集(“anscombe”)
AttributeError:“模块”对象没有“加载数据集”属性

有人遇到过同样的问题吗?我怎样才能解决它?谢谢

从stacktrace中,您的脚本似乎被命名为
seaborn.py
文件“seaborn.py”,第1行,在
中,
文件“E:\OneDrive\seek\u backward\caiwufenxi\source\seaborn.py”,第5行,在
中)。尝试在其他地方重命名它(如
test1.py
),然后重试


实际上,您正在尝试导入本地seaborn脚本(它没有load\u dataset功能),而不是已安装的模块。

只需将脚本名称从“seaborn.py”重命名为其他名称。

您显然将其中一个脚本命名为
seaborn.py
。这会影响模块导入。重命名它,它可能会工作。是的,你是对的,我重命名了脚本并删除了该错误,但它报告了一个新错误
AttributeError:“module”对象没有属性“load\u dataset”
。原因是什么?