python打包

利用pyinstaller打包python项目

conda create -n dabao
conda activate dabao
pip install pyinstaller
pyinstaller -F main.py

打包前
在这里插入图片描述

(xmlshibie) eec-ai@i-pc-038267:~/cui/xmlshibie$ pyinstaller -F main.py
1077 INFO: PyInstaller: 6.7.0, contrib hooks: 2024.6
1077 INFO: Python: 3.10.12
1092 INFO: Platform: Linux-6.5.0-35-generic-x86_64-with-glibc2.35
1092 INFO: wrote /home/eec-ai/cui/xmlshibie/main.spec
1096 INFO: Extending PYTHONPATH with paths
['/home/eec-ai/cui/xmlshibie']
2478 INFO: checking Analysis
2479 INFO: Building Analysis because Analysis-00.toc is non existent
2479 INFO: Running Analysis Analysis-00.toc
2479 INFO: Target bytecode optimization level: 0
2479 INFO: Initializing module dependency graph...
2517 INFO: Caching module graph hooks...
2576 INFO: Analyzing base_library.zip ...
3310 INFO: Loading module hook 'hook-heapq.py' from '/home/eec-ai/.local/lib/python3.10/site-packages/PyInstaller/hooks'...
3377 INFO: Loading module hook 'hook-encodings.py' from '/home/eec-ai/.local/lib/python3.10/site-packages/PyInstaller/hooks'...
5027 INFO: Loading module hook 'hook-pickle.py' from '/home/eec-ai/.local/lib/python3.10/site-packages/PyInstaller/hooks'...
6195 INFO: Caching module dependency graph...
6304 INFO: Looking for Python shared library...
6737 WARNING: Unrecognised line of output '缓存生成者: ldconfig (Ubuntu GLIBC 2.35-0ubuntu3.7) stable release version 2.35' from ldconfig
6737 INFO: Using Python shared library: /lib/x86_64-linux-gnu/libpython3.10.so.1.0
6737 INFO: Analyzing /home/eec-ai/cui/xmlshibie/main.py
6739 INFO: Processing module hooks...
6744 INFO: Performing binary vs. data reclassification (2 entries)
6998 INFO: Looking for ctypes DLLs
7002 INFO: Analyzing run-time hooks ...
7004 INFO: Including run-time hook '/home/eec-ai/.local/lib/python3.10/site-packages/PyInstaller/hooks/rthooks/pyi_rth_inspect.py'
7007 INFO: Looking for dynamic libraries
7361 INFO: Warnings written to /home/eec-ai/cui/xmlshibie/build/main/warn-main.txt
7370 INFO: Graph cross-reference written to /home/eec-ai/cui/xmlshibie/build/main/xref-main.html
7392 INFO: checking PYZ
7392 INFO: Building PYZ because PYZ-00.toc is non existent
7392 INFO: Building PYZ (ZlibArchive) /home/eec-ai/cui/xmlshibie/build/main/PYZ-00.pyz
7582 INFO: Building PYZ (ZlibArchive) /home/eec-ai/cui/xmlshibie/build/main/PYZ-00.pyz completed successfully.
7600 INFO: checking PKG
7600 INFO: Building PKG because PKG-00.toc is non existent
7600 INFO: Building PKG (CArchive) main.pkg
9718 INFO: Building PKG (CArchive) main.pkg completed successfully.
9720 INFO: Bootloader /home/eec-ai/.local/lib/python3.10/site-packages/PyInstaller/bootloader/Linux-64bit-intel/run
9720 INFO: checking EXE
9720 INFO: Building EXE because EXE-00.toc is non existent
9720 INFO: Building EXE from EXE-00.toc
9720 INFO: Copying bootloader EXE to /home/eec-ai/cui/xmlshibie/dist/main
9723 INFO: Appending PKG archive to custom ELF section in EXE
9784 INFO: Building EXE from EXE-00.toc completed successfully.

打包后
在这里插入图片描述
生成的exe文件位于dist文件夹下
在这里插入图片描述
运行

(xmlshibie) eec-ai@i-pc-038267:~/cui/xmlshibie$ cd dist/
(xmlshibie) eec-ai@i-pc-038267:~/cui/xmlshibie/dist$ ./main 
da bao test
good
  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值