2

Hi guys I am having issue importing matplotlib. I have python 3.6 installed. Python was installed from python.org. I am on macOS Sierra. When I import matplotlib in pycharm I get the following message:

import matplotlib.pyplot as plt ModuleNotFoundError: No module named 'matplotlib'

When I ran this code in terminal python 2.7, I received no error.

When I ran this code in terminal python3, I received the following error:

Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'matplotlib'

Any Suggestion?

NFS NFS
  • 37
  • 4
  • 2
    Install matplotlib (it's not distributed with vanilla python). Grab the docs for the *how*. If py2 is working and py3 is not, matplotlib is installed for py2, but not for py3. Not sure what you installed when and how. If you got a system-wide install of both with paths being set, ```pip2 install matplotlib``` will try to install it for py2, ```pip3 install matplotlib``` will do the same for py3, if the requirements (compilers and co.) are fulfilled. There is probably a function doing the same within pycharm (gui-like), but my experience there is limited. – sascha Jan 16 '17 at 03:06
  • Thanks it worked! Just realized that everything I was doing was for python 2.7 not Python 3.6. – NFS NFS Jan 16 '17 at 03:15

0 Answers0