添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
print mat

出现错误

Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'module' object has no attribute 'matlib'

原因在于numpy的__init__.py中并没有引入matlib,所以无法直接使用np.matlib。

修改如下

import numpy.matlib
mat = np.matlib.identity(3,dtype=float)
print mat

第一行直接引入numpy.matlib,这样就可以使用matlib中的函数了。

matlib是一个新的包,只有这样引入才不会错。

版权声明:本文为CSDN博主「qq_38071635」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接: https://blog.csdn.net/qq_38071635/article/details/81703238

python module has no attribute_求助AttributeError: module ' ' has no attribute ''

python module has no attribute 引用回帖:天天进步啊at2020-04-1520:41:22一看就知道是python代码,先把你代码贴出来,再讲你的报错...您好,这个代码是YanWu,MihaelaRosca,TimothyLillicrapDeepCompressedSensing.ICML2019的开源代码(Thisistheexa...