如何修复AttributeError:模块'numpy'没有属性'square'

Hod*_*deh 7 python numpy attributeerror python-3.x keras

我已将numpy更新为1.14.0.我使用Windows 10.我试图运行我的代码,我收到此错误:

AttributeError:模块'numpy'没有属性'square'

这是我的进口:

%matplotlib inline
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
from sklearn.metrics import confusion_matrix
import math
Run Code Online (Sandbox Code Playgroud)

Hod*_*deh 5

我删除了numpy.py,然后更新了numpy,它起作用了!

  • 我运行了`conda update --all`,`pip install -y numpy`,`pip install -y setuptools`,`pip install setuptools == 39.1.0`,和`pip install numpy`似乎解决了这个错误关于“'numpy'没有属性'square'”。 (2认同)
  • 上面的解决方案有效,只是我没有对版本进行硬编码。卸载 numpy 和 scipy,然后重新安装它们。 (2认同)