Cxfreeze使用存在问题

本文详细介绍了Cxfreeze工具的基本使用方法,包括如何通过命令行工具进行Python项目的打包,从单个文件到整个项目的打包流程,并提供了setup.py配置示例及创建桌面快捷方式的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Cxfreeze使用

cx_Freeze-5.1.1-cp36-cp36m-win_amd64.wh

1● 打包多个文件

Cxfreeze D:/test.py –target-dir D:/

 

cmd使用 管理员打包

 

cxfreeze D:\pyspace\pyChapter1\test\formTest.py --target-dir %desk%/aa

 

2● 打包单个文件

cxfree D:/text.py –target-dir D:/ --no-copy-deps

cxfreeze D:\pyspace\pyChapter1\test\formTest.py --target-dir %desk%/aa –no-copy-deps

3● setup.py配置

python setup.py bdist_msi
										

 

 

import sysfrom cx_Freeze import setup, Executable # Dependencies are automatically detected, but it might need fine tuning. build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]} # GUI applications require a different base on Windows (the default is for a console application). base = None if sys.platform == "win32": base = "Win32GUI" setup( name = "guifoo", version = "0.1", description = "My GUI application!", options = {"build_exe": build_exe_options}, executables = [Executable("guifoo.py", base=base)] )



 

 

 

 

D:\pyspace\pyChapter1\test\formTest.py

 

 

from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(packages = [], excludes = [])

import sys
base = 'Win32GUI' if sys.platform=='win32' else None

executables = [
Executable('D:/pyspace/pyChapter1/test/formTest.py', base=base, targetName = 'xx')
]

setup(name='xxx',
version = '1.0',
description = 'xxx',
options = dict(build_exe = buildOptions),
executables = executables)

 

4● 配置快捷路径

des

/d C:\Users\Administrator\Desktop

qq

/d D:\home\user\tencent\qq\file

desk

%userprofile%\desktop

 

 

目前就只能用 一个 命令

cxfreeze test.py –target-dir dist

转载于:https://www.cnblogs.com/rhxuza1993/p/8462174.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值