【问题标题】:PyArmor ERROR 'utf-8' codec can't decode byte 0x83 in position 594: invalid start bytePyArmor 错误“utf-8”编解码器无法解码位置 594 中的字节 0x83:无效起始字节
【发布时间】:2020-06-09 00:06:20
【问题描述】:

我正在使用 Python 进行开发,并尝试通过在 PyArmor 中键入以下命令来制作安装程序。

pyarmor pack -e " --onedir --noconsole --icon icon.ico -n testApp" main.py

然后我得到以下错误。

ERROR    'utf-8' codec can't decode byte 0x83 in position 594: invalid start byte

我输入并执行python main.py时没有错误。

只有在 PyArmor 运行时才会出现错误。

原因是什么?我该如何解决?

【问题讨论】:

    标签: python pyarmor


    【解决方案1】:

    正如文档中所说:https://pyarmor.readthedocs.io/en/latest/questions.html#xxx-codec-can-t-decode-byte-0xxx

    你应该在脚本的开头加上:# -*- coding: utf-8 -*-

    【讨论】:

    • 谢谢,我试过了,但没用。我不知道为什么。
    【解决方案2】:

    我不知道为什么,但是更改脚本执行文件夹解决了问题。

    如果我将 main.py 放在 C:\Users\username\Documents\testApp 文件夹和 cd C: \ Users \ username \ Documents \ testApp 中,则会出现错误。

    但是,当我将 main.py 放入 C:\Users\username\Desktop\testApp 文件夹和cd C: \ Users \ username \ Desktop \ testApp 时,错误消失了。

    这很奇怪。

    【讨论】:

      猜你喜欢
      • 2021-07-10
      • 2021-01-29
      • 2017-07-09
      • 2021-03-05
      • 1970-01-01
      • 2022-11-06
      • 2018-02-10
      • 2018-06-12
      相关资源
      最近更新 更多