Importerror: No Module Named Matplotlib.Pyplot

ImportError: No module named matplotlib.pyplot

You have two pythons installed on your machine, one is the standard python that comes with Mac OSX and the second is the one you installed with ports (this is the one that has matplotlib installed in its library, the one that comes with macosx does not).

/usr/bin/python

Is the standard mac python and since it doesn't have matplotlib you should always start your script with the one installed with ports.

If python your_script.py works then change the #! to:

#!/usr/bin/env python

Or put the full path to the python interpreter that has the matplotlib installed in its library.

Unable to use matplotlib after installation no module named 'matplotlib'

Can you check where the matplotlib package has been installed through this command?

pip show matplotlib

And you are using the global Python on your computer:

C:/Users/USER/AppData/Local/Programs/Python/Python38/python.exe

It should be different.

You can switch to the python interpreter which you have installed the packages you want to import. Or install the packages in the interpreter you are using.

ModuleNotFoundError: No module named 'matplotlib'

use pip3 install matplotlib to install matlplot lib.
By default, pip will install those package for 2.7 as it the native one.
using pip3 makes it specific for python 3, and make sure you have only one version of python 3

ModuleNotFoundError: No module named 'matplotlib.pyplotp'

As people in the comments pointed out, you simply have a typo in the import code.

As a side note, please do not post screenshots of code.

Instead copy the code and error message and format them as code in the question itself.

E.G:

import numpy as np
import matplotlib.pyplotp as plt
import pandas as pd

----------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-23-715cc5d20d02> in <module>
1 import numpy as np
--->2 import matplotlib.pyplotp as plt
3 import pandas as pd

ModuleNotFoundError: No module named 'matplotlib.pyplotp'


Related Topics



Leave a reply



Submit