python打包exe文件出错解决方案

    xiaoxiao2023-10-08  191

    Python——Pycharm打包exe文件

    一、安装pyinstraller pip install PyInstaller


    二.安装成功后,执行下面语句

    pyinstaller -F 文件名

    三.出错,错误信息如下:

    程序中出现中文,运行的时候出现如下错误: 导致出错的根源就是编码问题。

    F:\dasandeke\python\spider_three>pyinstaller -F demo1 File “C:\Users\AppData\Local\Programs\Python\Python37-32\Scripts\pyinstaller-script.py”, line 1 SyntaxError: Non-UTF-8 code starting with ‘\xcb’ in file C:\Users\孙玉红\AppData\Local\Programs\Python\Python37-3 2\Scripts\pyinstaller-script.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

    四.解决方案是:

    在程序最上面加上:

    # coding=gbk
    最新回复(0)