解决 ModuleNotFoundError: No module named matplotlib.pyplot 问题

最近在学习matplotlib基本操作,但在运行插入包操作的时候会报错。

import numpy as np
import matplotlib.pyplot as plt

plt.plot([1,2,3],[5,7,2])

plt.show()

报错显示:

Traceback (most recent call last):
  File "E:\python_work_1\matplotlib.py", line 2, in 
    import matplotlib.pyplot as plt
  File "E:\python_work_1\matplotlib.py", line 2, in 
    import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib.pyplot'

我通过卸载重装matplotlib解决了问题:

1.pip卸载matplotlib

python -m pip uninstall matplotlib

2.pip安装jupyter

python -m pip install jupyter

3.pip安装matplotlib

python -m pip install matplotlib

问题解决
解决 ModuleNotFoundError: No module named matplotlib.pyplot 问题_第1张图片

你可能感兴趣的:(python,matplotlib,python)