how to import matplotlib in python

后端 未结 4 1467
一向
一向 2021-02-19 06:19

I am new to python and I am working on a graph problem and I want to draw this graph to have a better understanding of it. I learnt that matplotlib module is supposed to be imp

相关标签:
4条回答
  • 2021-02-19 06:44

    work on the cv virtual environment and then use the command and execute your script in the virtual environment using source ~/.profile workon cv

    0 讨论(0)
  • 2021-02-19 06:46

    If you use windows, Open the command prompt and type

    python -m pip install matplotlib

    For linux users , type this

    sudo apt-get install python-matplotlib

    0 讨论(0)
  • 2021-02-19 06:47

    I had the same problem solved - not only for this package - using instead of pip install :

    sudo apt-get install python-matplotlib
    
    0 讨论(0)
  • 2021-02-19 07:04

    module: new

    As David Robinson points out in a comment on another answer you may have posted an incomplete error message, in which case it is possible that the inbuilt module new is being shadowed by new.py in the gis module. - if that is the case the suggested fix is to rename the gis version.

    Incomplete Matplotlib install

    Alternatively, given your output you may be trying to import networkx and you don't seem to have matplotlib (correctly) installed.

    Could you make sure that matplotlib is correctly installed, either if you're on Ubuntu by using

    sudo apt-get install python-matplotlib
    

    or if you prefer pip or easy_install,

    pip install matplotlib
    

    or

    easy_install matplotlib
    
    0 讨论(0)
提交回复
热议问题