python 打包程式

2022-06-25 07:42:15 字數 761 閱讀 6008

python寫的桌面程式給使用者使用,即不想給原始碼,也不想給他配置環境,可以打包成乙個exe給他使用。

安裝包pyinstaller

pip install pyinstaller
在cmd中cd到python指令碼的路徑,pyinstaller命令-f引數是打包成乙個exe,-w是不帶命令介面,後面跟上要打包的主指令碼。

pyinstaller -w   py_video.py
打包完後,同路徑下生成2個資料夾,build,dist,dist下就是打包的程式。

執行打包的程式,如果閃退,報錯缺失dll,有些第三方包會無法自動打包的情況。

則到除錯的python環境下python\lib\site-packages\找到該包放到打包好的程式裡。(如果有這類的也放到打包好的程式裡)

這種情況無法使用-f打包成乙個exe。

可以使用enigma virtual box,將他們重新打包成乙個exe

第乙個是剛才打包的程式exe,第二行是現在打包後要放的路徑,在點選新增資料夾遞迴,選擇剛才打包好的整個資料夾,再加點打包即可。

python程式打包

拷貝yourprogram.py到pyinstaller develop master目錄下,執行 python pyinstaller.py f yourprogram.py f打包成乙個.exe檔案indexerror tuple index out of range錯誤的原因為 python版...

python程式打包

環境 centos6.5 x64 python版本 2.6 pyinstaller可以將python程式打包成二進位制檔案,打包後的檔案在沒有python的環境中也可以執行 但要有相關底層libc相關so檔案 pyinstaller支援將python程式打包成單個檔案,它所做的只是將文字轉換成二進位...

python打包exe程式

1.安裝py2exe 2.編寫setup.py 如下 coding utf 8 from distutils.core import setup import py2exe powered by includes options setup options options,description m...