问题
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.
回答1:
This worked for me.
python -m pip install matplotlib==3.2
回答2:
There seems to be an incompatibility issue using Matplotlib version 3.3 with IPython. For now, you can fix it by installing Matplotlib 3.2.
回答3:
I had the same problem. I was using PyCharm. Installing PyQt5 worked for me.
来源:https://stackoverflow.com/questions/64291087/matplotlib-module-sip-has-no-attribute-setapi