跳转到主要内容

为Python应用程序构建NSIS安装程序。

项目描述

Pynsist是一个用于构建Windows安装程序的Python应用程序的工具。安装程序捆绑了Python自身,因此您可以向没有安装Python的人分发您的应用程序。

有关更多信息,请参阅文档示例

Pynsist 2.7需要Python 3.6或更高版本。您可以在Python 3.5上使用Pynsist 2.6,在Python 2.7和Python 3.3或更高版本上使用Pynsist 1.x,但这些版本将不再更新。

快速入门

  1. 获取工具。安装NSIS,然后通过运行pip install pynsist来从PyPI安装pynsist。

  2. 编写配置文件installer.cfg,如下所示

    [Application]
    name=My App
    version=1.0
    # How to launch the app - this calls the 'main' function from the 'myapp' package:
    entry_point=myapp:main
    icon=myapp.ico
    
    [Python]
    version=3.6.3
    
    [Include]
    # Packages from PyPI that your application requires, one per line
    # These must have wheels on PyPI:
    pypi_wheels = requests==2.18.4
         beautifulsoup4==4.6.0
         html5lib==0.999999999
    
    # To bundle packages which don't publish wheels, or to include directly wheel files
    # from a directory, see the docs on the config file.
    
    # Other files and folders that should be installed
    files = LICENSE
        data_files/
  3. 运行pynsist installer.cfg以生成您的安装程序。如果找不到pynsist,您可以使用python -m nsist installer.cfg代替。

此示例说明了如何使用Pynsist本身,用于简单项目。还有其他选项,可以使它更容易集成为更复杂构建过程中的一个步骤。有关更多信息,请参阅文档。

由以下提供支持