简体   繁体   中英

PyQt5 conflict with matplotlib in PyCharm

I have installed PyQt5 using pip install pyqt5. Installation is successful. A pip install of matplotlib says all requirements have been met. When I then run matplotlib I receive the flowing error:

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.

Searching states that the installed packages are likely different bit version (eg. 32bit when I need 54 bit). How can I fix this?

if you do not use pyqt and matplotlib together, then try to install conda and separate their environments. I encountered such a problem and I did so. I don't remember exactly what it was, but I remember that the qt 5.9 and qt 5.13 libraries were in conflict

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM