Python报错:NameError: name ‘plt‘ is not defined 加入以下一行代码即可: // 导入pyplot并将其命名为plt import matplotlib.pyplot as plt;