【问题标题】:Executable made with pyinstaller experiences "Fatal python error: initfsencoding"使用 pyinstaller 生成的可执行文件遇到“致命的 python 错误:initfsencoding”
【发布时间】:2019-01-21 16:00:28
【问题描述】:

我可以在我的电脑上通过 sublime text 运行我的 python (python 3.7) 程序。该程序使用 tkinter 和 sqlite3。 pyinstaller 不支持吗?

我在运行它时遇到的错误(只需双击在dist 中创建的文件:

Fatal Python error: initfsencoding: unable to load the file system codec 
zipimport.ZipImportError: can't find module 'encodings'

如果有人有这方面的经验,我们将不胜感激!

如果问题可能出在代码本身,我可以发布代码。

【问题讨论】:

  • 这是 pyinstaller 的问题,而不是 tkinter 或其他模块的问题。我确定您使用的是python 3.7。尝试卸载你的python(之前恢复你的文件),然后安装python 3.6.3
  • 已编辑以包含 python 版本。是的,我正在运行 3.7。为什么python 3.6.3
  • 好吧,我也不知道答案,你可以尝试使用除3.7之外的任何python 3.6版本。当我编写这个 GUI application 时,我也遇到了同样的情况,它也使用类似于 pyinstaller 的模块,即 cx_Freeze
  • 天哪,它成功了!谢谢!将其发布为答案,我会接受。

标签: python tkinter sqlite pyinstaller


【解决方案1】:

您正在使用python 3.7。据我测试,pyinstaller 之类的模块似乎不适用于此版本。尝试卸载你的python(不要忘记之前备份你的文件),然后安装python 3.6.3 或除python 3.7 之外的任何其他python 3 版本。我也发生了同样的事情,我这样做了。它奏效了。

【讨论】:

    猜你喜欢
    • 2019-12-06
    • 2017-01-31
    • 2014-01-04
    • 2019-08-02
    • 2022-01-04
    • 1970-01-01
    • 2020-10-15
    • 2021-09-02
    • 2019-06-02
    相关资源
    最近更新 更多