0
votes

i can not import matplotlib in jupyter notebook here are the codes which shows syntax errors

  1. import matplotlib.pyplot as plt

  2. import matplotlib

  3. from matplotlib import pyplot as plt

Traceback (most recent call last):

  File "C:\Users\suhas\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3437, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-4-99ba79ecbbfb>", line 1, in <module>
    from matplotlib import pyplot as plt

  File "C:\Users\suhas\matplotlib.py", line 13
    ------------------------
                            ^
SyntaxError: invalid syntax
1
You have a file called matplotlib.py thats causing some sort of clash. Move it somewhere else if possible, restart the notebook and then it should work.Kris

1 Answers

0
votes

You most likely have a file called matplotlib.py in the same folder as where your script is located. Thats where it is importing from (see the error for the destination)