matplotlib - module 'sip' has no attribute 'setapi'

醉酒当歌 提交于 2021-02-08 12:35:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!