目 录CONTENT

文章目录

python打包的几种方式

Administrator
2025-05-01 / 0 评论 / 0 点赞 / 25 阅读 / 0 字

1.pyinstaller

pip install pyinstaller
​
pyinstaller --onefile main.py

2.cx_Freeze

pip install cx_Freeze

#setup.py
from cx_Freeze import setup, Executable
​
setup(
    name = "Your Program",
    version = "1.0",
    description = "Your Program Description",
    executables = [Executable("your_program.py")]
)
python setup.py build

3.py2exe

pip install py2exe

#setup.py
from distutils.core import setup
import py2exe
​
setup(
    console=['your_program.py'],
    options={
        'py2exe': {
            'bundle_files': 1,
            'compressed': True,
        }
    }
)
​
python setup.py py2exe


0

评论区