Python Seaborn Lineplot 模块对象没有属性“Lineplot”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51846948/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 19:56:34  来源:igfitidea点击:

Seaborn Lineplot Module Object Has No Attribute 'Lineplot'

pythonmatplotlibvisualizationseaborn

提问by s-monie

Using seaborn's documentation code to generate a lineplot returns an AttributeError: 'module' object has no attribute 'lineplot'. I have updated seaborn and reimported the module and tried again, no luck. Did lineplot get retired, or is there something else going on?

使用 seaborn 的文档代码生成线图返回 AttributeError: 'module' object has no attribute 'lineplot'。我已经更新了 seaborn 并重新导入了模块并再次尝试,没有运气。lineplot 是退休了,还是发生了其他事情?

import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
fmri = sns.load_dataset("fmri")
ax = sns.lineplot(x="timepoint", y="signal", data=fmri)

回答by Anthony Lei

If you are using conda, you need to install seaborn with the version specified:

如果您使用的是 conda,则需要使用指定的版本安装 seaborn:

conda install -c anaconda seaborn=0.9.0

Once your seaborn 0.9.0 is installed properly, you should be able to use the lineplot function (at least it works on mine).

一旦您的 seaborn 0.9.0 安装正确,您应该能够使用 lineplot 功能(至少它适用于我的)。

That way you don't have to go outside of the conda ecosystem and use seaborn with pip.

这样你就不必走出 conda 生态系统并使用带有 pip 的 seaborn。

回答by s-monie

Lineplot works with update to seaborn 0.9. conda has not yet integrated seaborn 0.9.0 into it's default channel, which is why the update to 0.9 failed on my first go.

Lineplot 适用于 seaborn 0.9 的更新。conda 尚未将 seaborn 0.9.0 集成到其默认频道中,这就是为什么我第一次更新 0.9 失败的原因。

Couldn't Update Seaborn via Default Channel but found another way to do it through this answer

无法通过默认频道更新 Seaborn,但通过此答案找到了另一种方法

回答by CGFoX

As other's said before, you need seabornversion 0.9.0(or above will work too, I guess). The pip-way of doing this without condais:

正如其他人之前所说,您需要seaborn版本0.9.0(或以上版本也可以,我猜)。在pip这样做而不三通conda为:

pip install seaborn==0.9.0

My problem was that I had an older version ( 0.8.x) installed, so simply running pip install seaborndoesn't help in that case.

我的问题是我0.8.x安装了旧版本 ( ),因此pip install seaborn在这种情况下仅运行并没有帮助。

Alternatively, you can directly upgrade to the latest version of seabornlike this:

或者,您可以seaborn像这样直接升级到最新版本:

pip install -U seaborn

回答by Stryker

Within Jupyter notebook you can run the install without leaving the notebook.

在 Jupyter notebook 中,您无需离开 notebook 即可运行安装。

You only have to add the tag "y" to install the package.

您只需添加标签“y”即可安装软件包。

!conda install -y -c anaconda seaborn=0.9.0