• pyinstaller打包错误 UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 160:


    注:我的博客原本在CSDN,现转到博客园,图片采用以前的图片,并没有盗图。

    在将.py文件打包时,出现了下列错误

    >>C:Users小呆PycharmProjectspycharm编程>pyinstaller -F C:Users小呆PycharmProjectspycharm编程实验室笔试火车票.py
    
    >>Traceback (most recent call last):
      File "C:Users小呆AppDataLocalProgramsPythonPython36Scriptspyinstaller-script.py", line 13, in <module>
        load_entry_point('PyInstaller==3.3.1', 'console_scripts', 'pyinstaller')()
      File "C:Users小呆AppDataLocalProgramsPythonPython36libsite-packagesPyInstaller\__main__.py", line 94, in run
        run_build(pyi_config, spec_file, **vars(args))
      File "C:Users小呆AppDataLocalProgramsPythonPython36libsite-packagesPyInstaller\__main__.py", line 46, in run_build
        PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
      File "C:Users小呆AppDataLocalProgramsPythonPython36libsite-packagesPyInstalleruildinguild_main.py", line 791, in main
        build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
      File "C:Users小呆AppDataLocalProgramsPythonPython36libsite-packagesPyInstalleruildinguild_main.py", line 737, in build
        exec(text, spec_namespace)
      File "<string>", line 29, in <module>
      File "C:Users小呆AppDataLocalProgramsPythonPython36libsite-packagesPyInstalleruildingapi.py", line 397, in __init__
        self.console, self.uac_admin, self.uac_uiaccess)
      File "C:Users小呆AppDataLocalProgramsPythonPython36libsite-packagesPyInstallerutilswin32winmanifest.py", line 1076, in create_manifest
        old_xml = f.read()
    UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 160: illegal multibyte sequence
    

    是由于C:Users小呆AppDataLocalProgramsPythonPython36libsite-packagesPyInstallerutilswin32文件夹下的winmanifest.py下读取文件编码格式的问题。

    解:按错误代码的最后一个文件地址,在1075加一个'rb'。

  • 相关阅读:
    数学模型(第五版) 姜启源、谢金星、叶俊 版 课后答案 高等教育出版社 训练题答案 课后习题答案
    网络编程释疑之:同步,异步,阻塞,非阻塞
    Linux ssh黄金参数
    linux下安装java
    C/C++字符串和其他类型转换
    C语言获取当前时间
    C语言字符串复制
    C语言文件读写操作
    C语言实现读取文件所有内容到字符串
    AES加密的C语言实现
  • 原文地址:https://www.cnblogs.com/XD00/p/10626059.html
Copyright © 2020-2023  润新知