在终端执行: 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: