Skip to main content

Create a stand-alone Windows distribution of a Python program

Project description

Utility to create a stand-alone distribution of a Python program, either a console or GUI program. py2win uses Python embedded distribution and pip to create the stand-alone distribution.


You need:

  • Python >= 3.6
  • Microsoft Visual Studio, compatible with your current Python installation

Then simply run:

pip install py2win

How to use

As a command in

  1. Define at least one entry point in your
         'gui_scripts': ['sample-gui=sample.gui:main'],
         'console_scripts': ['sample-console=sample.console:main'],
  1. Run the bdist_windows command
python --command-packages py2win bdist_windows

As a separate script to create an embedded distribution

In a separate Python script (e.g. a file in the root directory), you can define the embed process using the EmbedPython class and call the run method.

from py2win.embed import EmbedPython

embed = EmbedPython('sample', '1.2.0')
embed.add_script(module='project.gui', method='main', executable_name='project-gui', console=False)

Release notes


  • Add support for arguments in console script (PR#1)
  • Use pathlib for paths
  • Use pytest for tests
  • Use black for formatting


  • First release




The library is provided under the MIT license.

Copyright (c) 2017-2019 Philippe Pinard

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py2win, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size py2win-0.2.0.tar.gz (6.5 kB) File type Source Python version None Upload date Hashes View
Filename, size py2win-0.2.0-py3-none-any.whl (9.4 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page