0

I am Unable to import matplotlib

I am able to import it through command prompt(python interpreter) But when i use it in a program with just one line import matplotlib as plt I am getting theese errors

Traceback (most recent call last):
  File "D:\python\gis\test.py", line 1, in <module>
    import matplotlib as plt
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 133, in <module>
    from matplotlib.rcsetup import (defaultParams,
  File "C:\Python27\lib\site-packages\matplotlib\rcsetup.py", line 19, in <module>
    from matplotlib.colors import is_color_like
  File "C:\Python27\lib\site-packages\matplotlib\colors.py", line 54, in <module>
    import matplotlib.cbook as cbook
  File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 15, in <module>
    import new
  File "D:\python\gis\new.py", line 27, in <module>
    nx.draw(G, pos=pos)
  File "C:\Python27\lib\site-packages\networkx-1.7.dev_20120522142611-py2.7.egg\networkx\drawing\nx_pylab.py", line 114, in draw
    raise ImportError("Matplotlib required for draw()")
ImportError: Matplotlib required for draw()

I have checked the path it contains only C:/python27 only not other python directories Guys please help me out

1 Answer 1

2

The D:\python\gis\new.py module is shadowing the Python standard library new module. Try rename your new module.

Sign up to request clarification or add additional context in comments.

1 Comment

This worked I do not know why i did not try before But now I am getting a runtime error for pythonw.exe from microsoftvisualc++ library if i edit it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.