问题
import matplotlib.pyplot as plt
Traceback (most recent call last):
import matplotlib.pyplot as plt
解决办法
—–尝试输入sudo apt-get install python-matplotlib,再运行程序通过。
But Why?
—–但是之前明明记得自己装过matplotlib包,是通过pip install matplotlib安装的,这个pip只是把包从网上下载,然后拷贝到python的某个目录下面,而操作系统中安装了多个版本的python和numpy,所以python找不到正确的numpy来支持matplotlib。
思路来源
Stack Overflow