Does matplotlib work with Python 3

ImportError: No module with the name matplotlib.pyplot


I'm practicing matplotlib right now. This is the first example I am practicing.

When I run this script with, the action is displayed correctly. However, I run it on my own, it raises the following:

Is Python looking for matplotlib in different places?

The environment is:

numpy, scipy, matplotlib is installed with:



Reply:


You have two pythons installed on your computer, 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 was installed in its library, the one that did is not supplied with Macosx). .

If that is standard Mac Python and since it doesn't exist, you should always start your script with the script that ports are installed on.

If this works, change the following to:

Or enter the full path to the Python interpreter on which the library is installed.






will make your life easier!

Step 1: Install Pip - Check if you already have Pip by simply writing Pip in the Python console. If you don't have a pip, call a python script called get-pip.py here: https://pip.pypa.io/en/latest/installing.html or directly here: https: //bootstrap.pypa. io / get-pip.py (You may need to use Save As ..)

Step 2: Make a note of where the file was saved and copy the directory using the command prompt. Run the get-pip.py script to install pip. You can write this line in quotes in cmd: "python. \ Get-pip.py"

Step 3: Now in cmd type:

And you should be through.





If you're using Python 2, just run it

The best way to get is:

Because the previous way may give you an old version of






That worked for me, inspired by Sheetal Kaul

I knew it was installed in the wrong location when this worked:


First, check the version of Python

for python2 version

for the Python3 version

If the matplotlib installation does not match the Python version, no module error will be displayed as no module will exit for that version.



If you are using Anaconda3

Simply put


I had a similar problem that I solved and here is my problem:

I set everything up on Python3, but I used Python to call my file, for example: I typed "python mnist.py" ... since I have everything on Python3 I thought I would try Python 2.7 too use

The correction: "python3 mnist.py" - the 3 made the difference

I'm not an expert on Python or Pip, but there is definitely a difference between pip and pip3 (pip is tied to Python 2.7) (pip3 is tied to Python 3.6)

When installing for 2.7 do: pip install when installing for 3.6 do: pip3 install

and if you run your code for 2.7 do: python, if you run your code for 3.6 do: python3

I hope this helps someone!


Comments in the normal feed are blocked. Let me write why this happens, just like it does when your app is running.

If you ran scripts, python, or ipython in a different environment than the one you installed, you will encounter these problems.

Don't confuse reinstallation. Matplotlib is usually installed in your user environment, not in sudo. They change the environment.

So don't reinstall pip, just make sure to run it as sudo if you installed it in the sudo environment.


I hit it with my head for hours until I thought about checking my .bash_profile. I didn't list a path for Python3 so I added the following code:

And then reinstalled matplotlib with. Everything works fine now.


So I used import matplotlib.pyplot as plt` and it worked.

We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.