首页 > 解决方案 > matplotlib - 模块“sip”没有属性“setapi”

问题描述

我刚刚使用所有 Python 扩展设置了 VS Code。通过 Anaconda 的 Python 版本是 3.8.3。解释器是 venv。当我运行这段代码

import matplotlib.pyplot as plt

错误显示 -

Exception has occurred: AttributeError
module 'sip' has no attribute 'setapi'
  File "C:\test.py", line 145, in <module>
    import matplotlib.pyplot as plt

我尝试卸载并重新安装 matplotlib,但无济于事。

标签: python-3.xmatplotlibvisual-studio-codeattributeerror

解决方案


这对我有用。

python -m pip install matplotlib==3.2

推荐阅读