ImportError: No module named matplotlib.pyplot

后端 未结 13 910
春和景丽
春和景丽 2020-11-28 02:03

I am currently practicing matplotlib. This is the first example I practice.

#!/usr/bin/python

import matplotlib.pyplot as plt

radius = [1.0, 2.0, 3.0, 4.0]         


        
13条回答
  •  一生所求
    2020-11-28 02:58

    I had a similar issue that I resolved and here is my issue:

    I set everything up on python3 but I was using python to call my file for example: I was typing "python mnist.py" ...since I have everything on python3 it was thinking I was trying to use python 2.7

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

    I'm by no means an expert in 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)

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

    and when running your code for 2.7 do: python when running your code for 3.6 do: python3

    I hope this helps someone!

提交回复
热议问题