pyinstaller使用错误 SyntaxError: Non-UTF-8 code starting with 'xb4' in file C:......

注:我的博客原本在****,现转到博客园,图片采用以前的图片,并没有盗图。​​
在将.py文件打包时,出现了下列错误

>>C:Users小呆PycharmProjectspycharm编程>pyinstaller

>>File "C:Users小呆AppDataLocalProgramsPythonPython36Scriptspyinstaller-script.py", line 1SyntaxError: Non-UTF-8 code starting with 'xb4' in file C:Users小AppDataLocalProgramsPythonPython36Scriptspyinstaller-script.py on line 1, but no encoding declared; seehttp://python.org/dev/peps/pep-0263/ for details

是由于Scripts文件夹下的pyinstaller-script.py不适合本机。

问题有二:

1. 编码不对。

解:首行加上coding:utf-8。必须是首行!!
pyinstaller使用错误  SyntaxError: Non-UTF-8 code starting with 'xb4' in file C:......

2. win10用户文件名存在中文,出现乱码。

解:将下面的地方改成中文。(乱码已经被我改掉了,每个人看自己的情况)

pyinstaller使用错误  SyntaxError: Non-UTF-8 code starting with 'xb4' in file C:......