Python报错:[function object has no attribute plot]原因解释

错误的翻译为,对象没有这个属性(plot)。
先看一个原先错的小例子的代码及结果
Python报错:[function object has no attribute plot]原因解释
Python报错:[function object has no attribute plot]原因解释
然后再看一下自己python的文件matplotlib的目录
Python报错:[function object has no attribute plot]原因解释
Python报错:[function object has no attribute plot]原因解释
现在应该一目了然了吧,错误的原因我把matplotlib里面的pyplot类中的plot()方法as为plt,然后plt只有plot方法,不具备show()方法,所以我们需要让
pyplot类as为plt,一下改正
Python报错:[function object has no attribute plot]原因解释
这样plt具有了show()和plot()的方法

这是个小问题,但是网上的信息比较有迷惑性,会很耽误初学者的时间,故在此写下这个小错误,同样的以后若是出现类似的错误可以得到有效解决。