python:使用PyInstaller打包成exe文件,以及TypeError: an integer is required (got type bytes)异常解决

用python3.6以上使用pyinstaller打包会出现 TypeError: an integer is required (got type bytes)异常,解决办法与安装pyinstaller教程如下:

1.安装PyInstaller

  • pip install PyInstaller

python:使用PyInstaller打包成exe文件,以及TypeError: an integer is required (got type bytes)异常解决

2. 常用的PyInstaller打包命令参数如下:

  • -F:打包 Python 程序为单个可执行文件
  • -D:打包 Python 程序为一个文件夹
  • -i:  生成图标,只适用于 Windows 平台              (ps:-i 参数后必须接 .ico 结尾的图标文件
  • -n: 指定打包后生成文件的名称
  • -w:禁止命令行弹出

3.打包单个py文件

  • PyInstaller -F xxx.py

python:使用PyInstaller打包成exe文件,以及TypeError: an integer is required (got type bytes)异常解决

4.结果出现异常 TypeError: an integer is required (got type bytes),解决方案,请输入如下命令:

  • pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz

python:使用PyInstaller打包成exe文件,以及TypeError: an integer is required (got type bytes)异常解决

出现异常请更新pip,再输入上条命令安装pyinstaller

  • python -m pip install --upgrade pip

5.再次执行PyInstaller -F xxx.py打包成功

python:使用PyInstaller打包成exe文件,以及TypeError: an integer is required (got type bytes)异常解决

6.目录结构如下,可执行exe文件在dist目录下

python:使用PyInstaller打包成exe文件,以及TypeError: an integer is required (got type bytes)异常解决

python:使用PyInstaller打包成exe文件,以及TypeError: an integer is required (got type bytes)异常解决

 

 7.完美解决TypeError: an integer is required (got type bytes)异常,使用PyInstaller打包完成。