Cannot import PyQtChart in Python 3.7

后端 未结 1 1789
一生所求
一生所求 2020-12-11 23:39

I am able to install PyQtChart without error using pip, but I cannot import it as Python (3.7.3) tells me there is no such module.

I\'m using Anaconda\'s Python dist

相关标签:
1条回答
  • 2020-12-12 00:04

    You have to have the same version of PyQt5 and PyQtChart installed:

    python -m pip install PyQt5==5.13 PyQtChart==5.13
    

    TL; DR;

    PyQt is a wrapper of the Qt, and each version of Qt generates .dll/.so that are not compatible with other versions. So that same problem moves to PyQt. In your case it is observed that the PyQt5 and PyQtChart libraries use different versions of Qt generating incompatibility.

    On the other hand that a module is called X does not imply that it is imported using: import X, in the case of PyQtChart you should use: from PyQt5 import QtChart.

    0 讨论(0)
提交回复
热议问题