日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

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

發布時間:2025/3/15 python 50 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python:使用PyInstaller打包成exe文件,以及TypeError: an integer is required (got type bytes)异常解决 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

本文主要介紹安裝pyinstaller教程與pyinstaller打包出現?TypeError: an integer is required (got type bytes)異常問題解決辦法:

1.安裝PyInstaller

執行:

pip install?PyInstaller

?

如果遇到warning提示:

WARNING: You are using pip version 19.3.1; however, version 21.1.3 is available.You should consider upgrading via the 'python -m pip install --upgrade pip' command.

就按照提示執行即可:

python -m pip install --upgrade pip

執行完上述指令后,再輸入pip install?PyInstaller確認下

安裝完畢~~

2. 常用的PyInstaller打包命令參數如下:

–i 圖標路徑;

-F 打包成一個exe文件;

-w 無控制臺窗口;

-c 使用控制臺;

-D 創建一個目錄,里面包含exe以及其他一些依賴性文件;

一般看幫助即可,-h

3.打包py文件

首先寫一個demo:test.py

import?ospath?=??os.getcwd()print(f'current?path?is:{path}')os.system('pause')

執行打包指令:

PyInstaller -F test.py

執行成功后會生成build、dist文件夾如下所示:

其中exe程序就在dist中,驗證一下:

大功告成!

4.針對有些童鞋執行打包結果出現異常問題:TypeError: an integer is required (got type bytes)

解決方案:請輸入如下命令:

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

就完美解決TypeError: an integer is required (got type bytes)異常,使用PyInstaller打包完成。

5.友情提示:

如果電腦中同時存在多個版本的python可能會導致各種異常問題,建議只保留一個版本的python使用,最好安裝前,先完全刪除老的,然后再安裝新的,防止不必要麻煩。

6.引經據典:

http://www.pyinstaller.org/downloads.html

https://pyinstaller.readthedocs.io/en/stable/usage.html#general-options

總結

以上是生活随笔為你收集整理的python:使用PyInstaller打包成exe文件,以及TypeError: an integer is required (got type bytes)异常解决的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。