pyinstaller打包时遇到的‘gbk‘ codec can‘t decode byte 0xaf错误解决办法

在终端执行: pyinstaller -F -w xxx.py时错误如下:

raceback (most recent call last):
  File "C:\Users\tianmeng\AppData\Local\Programs\Python\Python37\Scripts\pyinstaller-script.py", line 11, in <module>
    load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
  File "c:\users\tianmeng\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\tianmeng\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\tianmeng\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\building\build_main.py", line 838, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\users\tianmeng\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\building\build_main.py", line 784, in build
    exec(text, spec_namespace)
  File "<string>", line 32, in <module>
  File "c:\users\tianmeng\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\building\api.py", line 410, in __init__
    self.console, self.uac_admin, self.uac_uiaccess)
  File "c:\users\tianmeng\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 1076, in create_manifest
    old_xml = f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 166: illegal multibyte sequence

解决办法:点击如下链接跳转或打开红框内文件

将:

with open(filename) as f:
改为:

with open(filename, "rb") as f:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值