Home > other >  Having problems with importing matplotlib.pyplot as plt (ModuleNotFoundError: No module named '
Having problems with importing matplotlib.pyplot as plt (ModuleNotFoundError: No module named '

Time:08-08

I am having a problem importing matplot.pyplot as plt

import matplotlib.pyplot as plt

The error:

 File "c:\Users\Dave\Desktop\Finance\main.py", line 5, in <module>
    import matplotlib.pyplot as plt
  File "C:\Users\Dave\AppData\Roaming\Python\Python39\site-packages\matplotlib\__init__.py", line 109, in <module>
    from . import _api, _version, cbook, docstring, rcsetup
  File "C:\Users\Dave\AppData\Roaming\Python\Python39\site-packages\matplotlib\rcsetup.py", line 27, in <module>  
    from matplotlib.colors import Colormap, is_color_like
  File "C:\Users\Dave\AppData\Roaming\Python\Python39\site-packages\matplotlib\colors.py", line 51, in <module>   
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

I have tried to delete and reinstall the libraries including numpy, reloaded my IDE (I use vscode), and installed the pillow library.

CodePudding user response:

Try using a python virtual environment,https://docs.python.org/3/library/venv.html#:~:text=A virtual environment is a,part of your operating system.

install all your libraries there

CodePudding user response:

Sorry I don't know how I ended up solving this but I reopened this with vscode and it just worked sorry for the bother.

  • Related