【问题标题】:No module named 'pyqtgraph.graphicsItems.ViewBox.axisCtrlTemplate_pyqt5' while executing exe执行 exe 时没有名为 \'pyqtgraph.graphicsItems.ViewBox.axisCtrlTemplate_pyqt5\' 的模块
【发布时间】:2022-08-16 01:08:01
【问题描述】:

No module named \'pyqtgraph.graphicsItems.ViewBox.axisCtrlTemplate_pyqt5\'

使用 pyinstaller 创建 exe 文件后遇到此错误。

  • python-版本:3.8
  • pyqtgraph-版本:0.12.3
  • pyinstaller-版本:4.2
  • 我通过将未创建的模块文件导入到我的 python 代码中解决了这个错误。 from pyqtgraph.graphicsItems.ViewBox.axisCtrlTemplate_pyqt5 import * from pyqtgraph.graphicsItems.PlotItem.plotConfigTemplate_pyqt5 import * from pyqtgraph.imageview.ImageViewTemplate_pyqt5 import * from pyqtgraph.console.template_pyqt5 import * 问题是,虽然.exe文件运行正常,但是包含绘图的部分程序没有显示任何绘图。
  • 如果您已经解决了问题,您可以发表您的评论作为答案。
  • 其实我已经解决了这个错误。但正如我所提到的,在运行.exe 之后,我遇到了另一个问题。所以这不是确切的解决方案。

标签: python pyqt5 pyqtgraph


【解决方案1】:

即使使用新版本的 pyinstaller,我也遇到了同样的问题。在this 之后,我使用旧版本的pyinstaller (pip install pyinstaller==4.8) 解决了这个问题。

【讨论】:

    【解决方案2】:

    我最终将缺少的模块添加到spec 文件的hiddenimports 中:

    a = Analysis(...,  # other parameters
                 hiddenimports=[
                    'pyqtgraph.graphicsItems.ViewBox.axisCtrlTemplate_pyside6',
                    'pyqtgraph.graphicsItems.PlotItem.plotConfigTemplate_pyside6',
                    'pyqtgraph.imageview.ImageViewTemplate_pyside6',
                 ])
    

    这不仅仅是PyInstaller 的错。他们还没有为最近的pyqtgraph 更新准备钩子。 pyqtgraph 的降级应该会有所帮助,但我没有尝试过。

    【讨论】:

      猜你喜欢
      • 2023-04-05
      • 1970-01-01
      • 2017-05-19
      • 2017-01-15
      • 2021-06-06
      • 1970-01-01
      • 2019-01-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多