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

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

>>C:\Users\小呆\PycharmProjects\pycharm编程>pyinstaller -F C:\Users\小呆\PycharmProjects\pycharm编程\实验室笔试\火车票.py

>>Traceback (most recent call last):
  File "C:\Users\小呆\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller-script.py", line 13, in <module>
    load_entry_point('PyInstaller==3.3.1', 'console_scripts', 'pyinstaller')()
  File "C:\Users\小呆\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\__main__.py", line 94, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "C:\Users\小呆\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "C:\Users\小呆\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\building\build_main.py", line 791, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "C:\Users\小呆\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\building\build_main.py", line 737, in build
    exec(text, spec_namespace)
  File "<string>", line 29, in <module>
  File "C:\Users\小呆\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\building\api.py", line 397, in __init__
    self.console, self.uac_admin, self.uac_uiaccess)
  File "C:\Users\小呆\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\utils\win32\winmanifest.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\小呆\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInstaller\utils\win32文件夹下的winmanifest.py下读取文件编码格式的问题。

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

pyinstaller打包错误 UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 160:的更多相关文章

  1. UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 11126: illegal multibyte sequence

    python读取文件中含有中文时, 会报错: 解决办法是:打开文件时以utf-8格式打开,同样适用于gbk

  2. Python中解码decode()与编码encode()与错误处理UnicodeDecodeError: 'gbk' codec can't decode byte 0xab

    编码方法encoding() 描述 encode() 方法以指定的编码格式编码字符串,默认编码为 'utf-8'.将字符串由string类型变成bytes类型. 对应的解码方法:bytes decod ...

  3. Anaconda中启动Python时的错误:UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 553

    今天,在Anaconda prompt启动python遇到了如下错误: UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xaf in positi ...

  4. python打开文件查询字符串时报UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 19: illegal multibyte sequence错误

    当这样打开时报错了 lines = open(path).readlines() open(path).close() for line in lines: idx1 = line.find('检测到 ...

  5. python3.4 UnicodeDecodeError: 'gbk' codec can't decode byte 0xff in position

    python3.4 UnicodeDecodeError: 'gbk' codec can't decode byte 0xff in position 实用python的时候 打开一个csv的文件出 ...

  6. Python文件访问编码格式问题UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position xx: 解决方案

    1.Python读取文件 # .打开文件 file = open("ReadMe") # .读取文件类容 text = file.read() print(text) # .关闭文 ...

  7. Python读取文件时出现UnicodeDecodeError 'gbk' codec can't decode byte 0x80 in position x

    Python在读取文件时 with open('article.txt') as f: # 打开新的文本 text_new = f.read() # 读取文本数据出现错误: UnicodeDecode ...

  8. Python读取文件时出现UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position xx: 解决方案

    Python在读取文件时 with open('article.txt') as f: # 打开新的文本 text_new = f.read() # 读取文本数据 出现错误: UnicodeDecod ...

  9. 启动运行python3时 UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 170: illegal multibyte sequence

    重现 在cmd中输入Python,运行后,出现以下错误: Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64 ...

随机推荐

  1. spring boot -thymeleaf-异常处理

    异常流程 :controller-ControllerAdvice-异常解析器-默认的error页面 1.错误页面error.html: 程序出现异常会自动跳到error.html里,视频效果,该页面 ...

  2. 必须要会的 50 个 React 面试题

    翻译:疯狂的技术宅 原文:www.edureka.co/blog/interv… 如果你是一位有抱负的前端程序员并准备面试,那么这篇文章很适合你.本文是你学习和面试 React 所需知识的完美指南. ...

  3. 关于EF的三种分类----CodeFirst

    新建StudentInfo.cs using System; using System.Collections.Generic; using System.ComponentModel.DataAnn ...

  4. 【Python】正则表达式简单教程

    说明:本文主要是根据廖雪峰网站的正则表达式教程学习,并根据需要做了少许修改,此处记录下来以备后续查看. <Python正则表达式纯代码极简教程>链接:https://www.cnblogs ...

  5. python捕获Ctrl+C信号

    我们希望当服务器接收到一个 SIGTERM 信号时能够自动关机,或者做一些善后的操作,以下是实现的方法 import signal # 自定义信号处理函数 def my_handler(signum, ...

  6. 1. volatale 关键字 -内存可见性

    package com.gf.demo01; /** * 一.volatile 关键字:但多个线程进行操作共享数据时,可以保证内存中数据可见性. * */ public class TestVolat ...

  7. 在Java中进行序列化和反序列化

    对象序列化的目标是将对象保存在磁盘中,或者允许在网络中直接传输对象. 对象序列化允许把内存中的Java对象转换成平台无关的二进制流,从而允许把这种二进制流持久保存在磁盘上或者通过网络将这种二进制流传输 ...

  8. Async/Await是这样简化JavaScript代码的

    译者按: 在Async/Await替代Promise的6个理由中,我们比较了两种不同的异步编程方法:Async/Await和Promise,这篇博客将通过示例代码介绍Async/Await是如何简化J ...

  9. 我是这样搞懂一个神奇的BUG

    摘要: 通过分析用户的行为,才想得到为什么会出现这种情况! 前两天在BearyChat收到这样的一个报警消息: 409 ?Conflict ? 平时很少遇到这样的错误,貌似很严重的样子,吓得我赶紧查看 ...

  10. React.cloneElement

    作用: 克隆react element, 并传递props, 和children React.cloneElement( element, [props], [...children] ) // ch ...