No module named matplotlib.pyplot

problem

After installing the matplotlib in cmd by using command:

 
pip install matplot 

and then coding in script.py:

 
import matplotlib.pyplot as plt
bla bla bla 
bla bla bla

it returns error: No module named matplotlib.pyplot


solution

I created a new project named matplotlib in Pycharm. Open this project in Pycharm, turn to the Terminal and type:

 
pip install matplot 

then, the import command works without errors.

I don’t fully understand the reason why this happen, one thing for sure is in the former example, matplotlib can not be imported into our working project correctly. So if you have this problem, you`d better install matplotlib in your current/new project by using the Terminal of you IDE.






公众号

关注公众号,获取一手资讯

“ No module named matplotlib.pyplot ” comments 0

评论/回复

电子邮件地址不会被公开。 必填项已用*标注