Home > OS >  Pylint: how to fix ModuleNotFoundError: No module named 'matplotlib'
Pylint: how to fix ModuleNotFoundError: No module named 'matplotlib'

Time:09-21

I know I have matplotlib installed but I get an error when trying to run it. I tried to follow the steps here. but when I run it again I get the following:

python -u "/Users/MacBook/python/code/stats.py"
/Users/MacBook/.fzf.zsh:source:13: no such file or directory: /Users/xxxxx 1/.fzf/shell/key-bindings.zsh
/Users/MacBook/.zshrc:export:2: not valid in this context: Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/bin:/usr/vac/bin:/usr/vacpp/bin:.:/Users/xxxxx
MacBook@MacBook-Air python % python -u "/Users/MacBook/python/code/stats.py"
Traceback (most recent call last):
  File "/Users/MacBook/python/code/stats.py", line 2, in <module>
    import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'

This happens in VS code: I am running python 3.9.4

CodePudding user response:

I had a similar issue, so here a few things I tried:

  • Switch interpreter to python with conda in the name
  • reload VS code
  • if that still doesn't work, try to activate via source activate Macbook
  • Related