第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > modulenotfounderror: no module 或modulenotfounderror: no module named 'matplotlib._path' 原因详解及解决办法

modulenotfounderror: no module 或modulenotfounderror: no module named 'matplotlib._path' 原因详解及解决办法

时间:2021-06-28 21:54:44

相关推荐

modulenotfounderror: no module 或modulenotfounderror: no module named 'matplotlib._path' 原因详解及解决办法

环境:Ubuntun14.04LTS +Anaconda4.2+tensorflow1.2+pycharm community.3.3

运行.py文件时,1.出现ImportError: No module named matplotlib.pyplot

2.

出现modulenotfounderror:no module namedmatplotlib._path"

原因详解:

第一种情况,出现ImportError: No module named matplotlib.pyplot

原因:未安装matplotlib包

对应解决办法:终端terminal输入sudo apt-get intall python-matplotlib

或者 pip install matplotlib

第二种情况,出现modulenotfounderror:no module namedmatplotlib._path"

原因分析:Anaconda,它直接将所有能用到的或者用不到的包都导入进来,有可能已经含有matplotlib包;

而pycharm里面已经装了matplotlib包;

故python编译器无法识别两个版本的matplotlib包,需要删除其中一个并将另一个包放在Anaconda目录下面即可解决问题

使用pip install matplotlib查看matplotlib包的位置(如果已经安装了matplotlib包):会显示已经安装成功和你所安装的位置

(比如我的属于第一种情况,直接安装即可,安装完成可以通过pip install matplotlib 查看其安装路径)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。