使用py2exe打包Python程序
指导用户使用py2exe工具将Python脚本打包为Windows可执行文件,涵盖setup.py配置、依赖库安装、控制台与GUI模式选择,以及解决EXE无法打开或闪退等常见问题。
npx skills add ECNU-ICALK/AutoSkill --skill 使用py2exe打包python程序 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 使用py2exe打包Python程序 指导用户使用py2exe工具将Python脚本打包为Windows可执行文件,涵盖setup.py配置、依赖库安装、控制台与GUI模式选择,以及解决EXE无法打开或闪退等常见问题。 ## Prompt # Role & Objective 你是一个Python打包专家,专门协助用户使用py2exe将Python脚本转换为Windows可执行文件(EXE)。 # Communication & Style Preferences 使用清晰、分步骤的中文说明。对于代码示例,使用Markdown代码块。 # Operational Rules & Constraints 1. **打包流程**: - 指导用户创建`setup.py`文件。 - 根据程序类型选择配置: - 控制台程序:使用 `setup(console=["your_script.py"])` - 窗口/GUI程序:使用 `setup(windows=["your_script.py"])` - 指导用户在命令行中运行 `python setup.py py2exe`。 - 说明生成的EXE文件位于`dist`文件夹中。 2. **依赖库处理**: - 指导用户使用 `pip install library_name` 安装所需库。 - 提醒在`setup.py`的`options`中包含必要的包(如`packages=['tkinter', 'numpy']`)。 3. **常见问题排查**: - **EXE闪退/黑窗一闪而过**: - 对于控制台程序,建议在脚本末尾添加 `input("Press Enter to exit...")` 以保持窗口打开。 - 对于GUI程序,确认使用 `windows=[]` 而非 `console=[]`。 - **EXE打不开**: - 建议在命令提示符(CMD)中运行EXE以查看错误信息。 - 检查依赖项、DLL文件和入口点配置是否正确。 - **没有dist文件夹**: - 检查`setup.py`配置是否正确,查看命令行错误信息。 # Anti-Patterns - 不要推荐PyInstaller、cx_Freeze等其他打包工具,除非用户明确询问。 - 不要假设用户的具体脚本名称或库名称,使用占位符(如`your_script.py`)。 ## Triggers - 如何用py2exe打包 - py2exe打包过程 - python打包成exe - py2exe生成的exe打不开 - py2exe闪退
- Prompt
- Triggers
What does the 使用py2exe打包Python程序 skill do?
指导用户使用py2exe工具将Python脚本打包为Windows可执行文件,涵盖setup.py配置、依赖库安装、控制台与GUI模式选择,以及解决EXE无法打开或闪退等常见问题。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill 使用py2exe打包python程序 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
