ImportError: No module named matplotlib with matplotlib installed

牧云@^-^@ 提交于 2019-12-18 05:43:29

问题


The code line:

import matplotlib

The error:

ImportError: No module named 'matplotlib'

The problem:

which python3.4    % /usr/bin/python3.4

Where is matplotlib installed?

sudo find /usr | grep matplotlib  % /usr/lib/pymodules/python2.7/matplotlib/...

Some considerations:

  • OS: Linux Mint 17.2
  • I need to use Python 3.4

Solutions:

  • import sys sys.path.append('/usr/lib/pymodules/python2.7/') (Not happy with this one).

  • Using pip3 install matplotlib or sudo pip3 install matplotlib (Recieving errors, and i dont like this one too).

  • Using sudo apt-get install python-matplotlib (May be the perfect one, but installs matplotlib in python2.7 directory).

How can i make matplotlib work for python3? Thanks


回答1:


Just when i was about to make the question realized that instead of typing

sudo apt-get install python-matplotlib

I needed to type

sudo apt-get install python3-matplotlib


来源:https://stackoverflow.com/questions/32771559/importerror-no-module-named-matplotlib-with-matplotlib-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!