python打包成exe出现报错如何解决TypeError: an integer is required (got type bytes)

2023-06-25,,

**python 文件打包成exe可执行文件文件

文章目录

python
一、打包的好处
二、使用步骤
1.打开cmd窗口,先安装pyinstaller
2.在打开的命令行中输入


python

本文章是为了完成python文件的打包,生成exe文件


一、打包的好处

示例:打包成exe文件可以在一些别的系统上运行,没有python也能运行

二、使用步骤

1.打开cmd窗口,先安装pyinstaller

按win+R,输入cmd

```

2.在打开的命令行中输入

代码如下(示例):

pip install pyinstaller

若是显示

WARNING: You are using pip version 21.1.1; however, version 21.1.2 is available.
You should consider upgrading via the 'd:\python-version\python.exe -m pip install --upgrade pip' command.

则需要安装新的pip

python -m pip install --upgrade pip


## 在打开的命令行中安装pyinstaller

pip show pyinstaller
若出现库的信息,就说明安装成功了


## pip使用

pip查看插件列表

pip list

##进行打包,

pyinsatller python 文件
就可以在该目录下找到3个文件夹,一个是__pycache__,一个是build,
一个是dist__pycache__ 是 python 编译好的 pyc 字节码文件dist
会有一个.exe,如果想最终只合成一个 .exe 文件,可以加上 -F 选项,
即 pyinstaller -F python.py,这样就成功了。出现Building EXE
from EXE-00.toc completed successfully.
就成功了


##出现报错:TypeError: an integer is required (got type bytes) :

出现这种情况,观察命令行报错是否有需要安装 wheel,如图片所示
(https://img-blog.csdnimg.cn/2021053121031574.png?x-oss-process=i
mage/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6L
y9ibG9nLmNzZG4ubmV0L3pseTAz,size_16,color_FFFFFF,t_70#pic_center)
pip install wheel
再重新打包


提示:以上是小白学习学的,望各位大佬指导,本文仅仅简单介绍了pyinstaller的使用,本文只是用来记录学习用的,参考链接:(https://blog.csdn.net/zcc1229936385/article/details/103270054?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522162246204416780366571941%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=162246204416780366571941&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-103270054.first_rank_v2_pc_rank_v29&utm_term=TypeError:%20an%20integer%20is%20required%20%28got%20type%20bytes%29&spm=1018.2226.3001.4187)

python打包成exe出现报错如何解决TypeError: an integer is required (got type bytes)的相关教程结束。

《python打包成exe出现报错如何解决TypeError: an integer is required (got type bytes).doc》

下载本文的Word格式文档,以方便收藏与打印。