sip 模块实现 API v11.0 到 v11.2 但 PyQt5.QtCore 模块需要 API v11.3

The sip module implements API v11.0 to v11.2 but the PyQt5.QtCore module requires API v11.3

我对这个错误有疑问。作为记录,我使用的是 PyQt4。感谢您的帮助!

 (C:\Users\ewasn\Anaconda2) C:\Users\ewasn\Desktop\DataShift>python data_inconsistency_api.py
Traceback (most recent call last):
  File "data_inconsistency_api.py", line 9, in <module>
    from multivariate_outliers import MultivariateOutliers
  File "C:\Users\ewasn\Desktop\DataShift\multivariate_outliers.py", line 8, in <module>
    import matplotlib.pyplot as plt
  File "C:\Users\ewasn\Anaconda2\lib\site-packages\matplotlib\pyplot.py", line 114, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:\Users\ewasn\Anaconda2\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "C:\Users\ewasn\Anaconda2\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "C:\Users\ewasn\Anaconda2\lib\site-packages\matplotlib\backends\backend_qt5.py", line 27, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "C:\Users\ewasn\Anaconda2\lib\site-packages\matplotlib\backends\qt_editor\figureoptions.py", line 17, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "C:\Users\ewasn\Anaconda2\lib\site-packages\matplotlib\backends\qt_editor\formlayout.py", line 58, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "C:\Users\ewasn\Anaconda2\lib\site-packages\matplotlib\backends\qt_compat.py", line 127, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
RuntimeError: the sip module implements API v11.0 to v11.2 but the PyQt5.QtCore module requires API v11.3

我使用 pip 卸载并重新安装 sip 解决了这个问题。

pip uninstall sip
pip install sip

只是进行升级可能也有效,但我在升级过程中遇到错误,因为文件正在使用中。

在 Anaconda 中执行等效操作可能会解决问题。

我在 pycharm 和 pyqt4 上遇到了同样的错误……对我来说,解决方案是:

python版本(在我的例子中是python3.4) pyqt4 版本必须匹配 ... 所以我安装了 python-3.4.4.msi 然后安装了 PyQt4-4.11.4-gpl-Py3.4-Qt4.8。 -x32.exe

现在可以了