python转exe报错 UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in pos

版权声明:转载请注明出处 https://blog.csdn.net/qq_33289175/article/details/87311087

python转exe时报错

UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in pos

原因:

pyinstaller读文件错误

解决方法

找到PyInstaller里的winmanifest.py文件

 找到1076行:old_xml = f.read()。

 将其中的1075行改为:

     with open(filename,encoding="UTF-8") as f: 

寻找方法:1、进入pyinstaller的安装路径,参考下面文章

扫描二维码关注公众号,回复: 5405654 查看本文章

https://blog.csdn.net/qq_33289175/article/details/87311631

                   2、找到utils--win32,即可看到

              3、用notepad++或记事本打开

         4、ctrl+f搜索  with open(filenam

5、改为 with open(filename,encoding="UTF-8") as f:

猜你喜欢

转载自blog.csdn.net/qq_33289175/article/details/87311087