Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>py2exeNew to Visual Studio Code? Get it now.
py2exe

py2exe

zynx

|
1,565 installs
| (0) | Free
Advanced Python to EXE converter with PyInstaller integration, configuration options, and build management.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Py2Exe – Advanced Python to EXE Converter for VS Code

A powerful Visual Studio Code extension that converts Python scripts into standalone Windows executables using PyInstaller with advanced configuration options, progress tracking, and build management.

✨ Features

Core Functionality

  • One-click conversion directly from the editor toolbar
  • Smart file detection - works with active Python files or file picker
  • Build progress tracking with real-time notifications
  • Automatic PyInstaller detection and installation prompts

Advanced Options

  • Executable types: Single file or directory-based executables
  • Application modes: Console or windowed (no console) applications
  • Icon management: Default icons, custom selection, or no icon
  • Hidden imports support for complex dependencies
  • Data files inclusion (source:destination mapping)
  • Additional PyInstaller arguments for full control

Configuration & Management

  • VS Code settings integration with persistent configuration
  • Custom output directories for better project organization
  • Automatic cleanup of build files and temporary artifacts
  • Build file management with dedicated clean command
  • Custom Python path support for virtual environments

User Experience

  • Input validation for executable names
  • Post-build actions: Run, open in Explorer, or open terminal
  • Error handling with clear feedback and solutions
  • Progress indication during build process
  • Terminal integration for build output visibility

🚀 Quick Start

  1. Install the extension from the VS Code Marketplace
  2. Open a Python file in the editor
  3. Click "Convert to EXE" in the editor toolbar or use the command palette
  4. Configure options in the dialog prompts
  5. Wait for completion and choose post-build action

⚙️ Configuration

The extension can be configured through VS Code settings (py2exe.*):

Setting Type Default Description
py2exe.defaultOutputDir string "dist" Default output directory for executables
py2exe.autoClean boolean false Automatically clean build files after successful compilation
py2exe.defaultIconPath string "" Default icon path for executables
py2exe.advancedMode boolean false Enable advanced PyInstaller options
py2exe.pythonPath string "" Custom Python executable path

Advanced Mode

When py2exe.advancedMode is enabled, you'll have access to:

  • Additional PyInstaller arguments (e.g., --upx-dir=/path/to/upx --debug=all)
  • Hidden imports (comma-separated module names)
  • Data files (source:destination pairs, comma-separated)

📋 Requirements

  • Visual Studio Code 1.107.0 or higher
  • Python 3.7 or higher
  • PyInstaller (auto-detected and can be installed automatically)

🛠️ Commands

Command ID Description
Convert to EXE py2exe.convert Convert current Python file to executable
Configure Settings py2exe.configure Open Py2Exe settings in VS Code
Clean Build Files py2exe.clean Remove build artifacts and temporary files

📁 Build Process

The extension follows this build workflow:

  1. File Selection - Active Python file or file picker
  2. Configuration - Name, type, icon, and advanced options
  3. Validation - Check PyInstaller installation
  4. Build - Execute PyInstaller with progress tracking
  5. Completion - Post-build actions and cleanup (if enabled)

🎯 Usage Examples

Basic Conversion

  1. Open my_app.py in VS Code
  2. Click the "Convert to EXE" button in the editor toolbar
  3. Enter executable name: my_app
  4. Choose "Single file executable" and "Console application"
  5. Select "No icon"
  6. Wait for completion and choose "Run EXE"

Advanced Conversion with Icon

  1. Use command palette: "Py2Exe: Convert to EXE"
  2. Select your Python file
  3. Enter name: advanced_app
  4. Choose "Directory-based executable" and "Windowed application"
  5. Select "Choose custom icon" and pick your .ico file
  6. Enable advanced mode for hidden imports: numpy,pandas,matplotlib
  7. Add data files: assets:data,config.json:config.json

🔧 Troubleshooting

Common Issues

PyInstaller not found

  • Extension will prompt to install automatically
  • Or install manually: pip install pyinstaller

Build fails with import errors

  • Use advanced mode to add hidden imports
  • Check that all dependencies are installed in your Python environment

EXE doesn't run on other machines

  • Ensure all required data files are included
  • Test on clean Windows environment
  • Consider using directory-based mode for complex applications

Permission errors

  • Run VS Code as administrator if needed
  • Check antivirus software isn't blocking the process

Debug Tips

  1. Check the terminal output for detailed PyInstaller logs
  2. Verify Python environment with correct dependencies
  3. Test with simple script first to isolate issues
  4. Use clean command to remove corrupted build files

📝 Development

Building the Extension

npm install
npm run compile

Testing

npm run test

Packaging

vsce package

🤝 Contributing

Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.

📄 License

This extension is licensed under the MIT License.

🔗 Related Extensions

  • Python - Official Python extension for VS Code
  • Python Docstring Generator - Generate docstrings automatically
  • Python Test Explorer - Run and debug Python tests

📊 Changelog

v0.1.1

  • Added advanced configuration options
  • Improved error handling and user feedback
  • Added progress indication during builds
  • Implemented build file management
  • Enhanced package metadata and documentation

v0.1.0

  • Initial release with basic PyInstaller integration
  • One-click conversion from editor toolbar
  • Basic icon and console options

Made with ❤️ for the Python community

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft