I just set up the VS Code with all the Python extensions. Python version is 3.8.3 through Anaconda. The interpreter is venv. When I run this code
import matplotlib.pyplot as plt
An error shows -
Exception has occurred: AttributeError module 'sip' has no attribute 'setapi' File "C:\test.py", line 145, in <module> import matplotlib.pyplot as plt
I've tried uninstalling and reinstalling matplotlib, but to no avail.
The Python "ModuleNotFoundError: No module named 'matplotlib'" occurs when we forget to install the matplotlib module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install matplotlib command.
To verify that Matplotlib is installed, try to invoke Matplotlib's version at the Python REPL. Use the commands below that include calling the . __version__ an attribute common to most Python packages.
This worked for me.
python -m pip install matplotlib==3.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With