AttributeError: module ‘matplotlib’ has no attribute ‘figure’

报错:AttributeError: module ‘matplotlib’ has no attribute ‘figure’

修改前:

import matplotlib as plt
plt.figure()
plt.imshow(trainImages[10])
plt.colorbar()
plt.grid(False)

修改为:import matplotlib.pyplot as plt
修改后:

import matplotlib.pyplot as plt
plt.figure()
plt.imshow(trainImages[10])
plt.colorbar()
plt.grid(False)

你可能感兴趣的:(tensorflow,matplotlib,python,机器学习,深度学习,人工智能)