【问题标题】:The exe file generated by PyInstaller does not workPyInstaller生成的exe文件不起作用
【发布时间】:2016-06-27 20:23:04
【问题描述】:

PyInstaller 以前运行良好。 但是,安装 Jupyter 后,PyInstaller 新生成的 exe 文件不起作用,例如警告 no module named Tkinter。 如果卸载 Jupyter 并再次通过 PyInstaller 生成 exe 文件,新的 exe 文件就可以正常工作了。

这两者有什么冲突吗? 如何解决这个问题呢?我想继续安装 Jupyter。

【问题讨论】:

  • 尝试安装 Tkinter tkdocs.com/tutorial/install.html
  • Tkinter 已包含在 Python 中。卸载 Jupyter 后,从同一个 py 文件生成的新 exe 文件运行良好,没有警告 'no module named Tkinter'。

标签: python pyinstaller


【解决方案1】:

通过改变模块的顺序来解决。

旧订单: 从 Tkinter 导入 * 导入 tkFileDialog 将 matplotlib.pyplot 导入为 plt 将 numpy 导入为 np 导入 PIL.Image 导入pylab from matplotlib.colors import LightSource, Normalize,LinearSegmentedColormap

新订单: 将 matplotlib.pyplot 导入为 plt 将 numpy 导入为 np 导入 PIL.Image 导入pylab 从 matplotlib.colors 导入 LightSource、Normalize、LinearSegmentedColormap 从 Tkinter 导入 * 导入 tkFileDialog

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-06
    • 1970-01-01
    • 1970-01-01
    • 2019-12-04
    • 1970-01-01
    • 2020-11-17
    • 1970-01-01
    • 2015-02-13
    相关资源
    最近更新 更多