这是由于导入的numpy版本过低所致,需要升级至1.12及以上版本。在命令行输入“pip install numpy --upgrade”即可升级。如果升级后仍出现此问题,可以尝试重装numpy库。
示例代码:
import numpy as np
print(np.version)
data = np.loadtxt(np.lib._datasource.open('test.txt'))
print(data)
上一篇:AttributeError:module'git'hasnoattribute'Repo'-workingonlocalmachinebutnotonremoteserver
下一篇:AttributeError:module'scikitplot'hasnoattribute'plot_precision_recall_curve'