PyQt5与PyCharm中的matplotlib冲突

时间:2018-04-03 16:36:01

标签: python matplotlib pyqt5

我使用pip install pyqt5安装了PyQt5。安装成功。 matplotlib的pip安装表示已满足所有要求。当我运行matplotlib时,我收到了流动的错误:

Traceback (most recent call last):
  File "", line 6, in <module>
    import matplotlib.pyplot as plt
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\__init__.py", line 62, in pylab_setup
    [backend_name], 0)
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 15, in <module>
    from .backend_qt5 import (
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 19, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\qt_editor\figureoptions.py", line 20, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\qt_editor\formlayout.py", line 54, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\qt_compat.py", line 140, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
ImportError: DLL load failed: %1 is not a valid Win32 application.

搜索表明已安装的软件包可能是不同的位版本(例如,当我需要54位时为32位)。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

如果您不同时使用pyqt和matplotlib,请尝试安装conda并将其环境分开。我遇到了这样的问题,我做到了。我不记得确切是什么,但我记得qt 5.9和qt 5.13库发生冲突