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

python:使用PyInstaller打包成exe文件,以及TypeError: an integer is required (got type bytes)异常解决
2019-11-12 15:50:22 小伙子。 阅读数 225 文章标签: python打包exepyinstaller 更多
分类专栏: python
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.****.net/weixin_44096448/article/details/103031187
用python3.6以上使用pyinstaller打包会出现 TypeError: an integer is required (got type bytes)异常,解决办法与安装pyinstaller教程如下:
1.安装PyInstaller
    • pip install PyInstallerpython:使用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.pypython:使用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.gzpython:使用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打包完成。

 

 

 

其它说明:如果电脑中同时存在多个版本的python可能会导致各种问题(比如 “failed to execute script xxx” 、“failed to create process”),如果不是特别熟悉使用python只是为了偶尔使用的话最好把以前安装的多余的python版本删掉或全部删掉重新安装(到官网下载最新的安装程序,网上说32位的兼容性比较好)
————————————————
 

来自 <https://blog.****.net/weixin_44096448/article/details/103031187>