欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

PyQtDeploy新手指南:构建v2.3.1版本的PyQtDeploy项目

最编程 2024-07-19 21:13:44
...

Name

用于指定最终应用程序可执行文件的名称。 如果未指定,则从主脚本文件的名称派生。 如果应用程序没有主脚本文件,则该名称将从应用程序包的名称派生。

Main script file

用于指定调用应用程序的可执行Python脚本的名称。 It should not be specified if an entry point is

specified.

Note

无论何时指定文件或目录,pyqtdeploy总是相对于包含项目文件的目录保存其名称(如果可能)。 在此特定示例中,pyqt-demo.py脚本与pyqt-demo.pdy项目文件位于同一目录中。 此外,无论何时输入文件或目录名称,pyqtdeploy都允许嵌入环境变量,必要时将对其进行扩展。 PDY_PY_MAJOR, PDY_PY_MINOR和 PDY_PY_MICRO伪 - 也可以使用环境变量,这些变量将扩展到目标Python版本的相关部分。

Entry Point

用于指定基于setuptools的应用程序的入口点。 如果指定了主脚本文件,则不应指定它。

sys.path

用于指定将添加到sys.path的其他目录中的ZIP文件和egg文件。 默认情况下,pyqtdeploy会生成一个不支持导入未嵌入应用程序的软件包或扩展模块的应用程序。 但是在某些情况下需要这种能力:

您需要使用不支持静态编译的扩展模块

您允许用户编写由应用程序导入的Python代码,以配置或扩展其功能。

该路径被指定为以空格分隔的目录列表。 单引号或双引号可用于在目录名中嵌入空格。 运行应用程序时会扩展环境变量(使用标准UNIX表示法指定)。 获取任何相关的目录名,包含应用程序可执行文件的目录。 应使用UNIX路径分隔符 - 在Windows上运行时,应用程序将自动执行适当的转换。

pyqtdeploy还支持动态加载与应用程序可执行文件相邻安装的扩展模块(即与应用程序可执行文件位于同一目录中)。 这对于作为纯Python模块和扩展模块的组合实现的包非常有用,其中扩展模块不支持静态编译。 纯Python模块将像任何其他Python包一样添加(参见添加其他包)。 必须根据包结构中的正常位置命名扩展模块。

例如,假设我们有一个名为foo的包,它包含纯Python模块__init__.py和bar.py文件以及一个动态加载的扩展模块baz.so。 (在Windows上,扩展模块将被称为baz.pyd。) 与已部署的应用程序一起使用时,模块必须作为foo.baz.so(或foo.baz.pyd)安装在与应用程序可执行文件相同的目录中。

在macOS上,还将在包含应用程序可执行文件的目录的PlugIns和Frameworks子目录中搜索扩展模块。

相邻的扩展模块不需要设置sys.path。

Note

如果您希望允许导入外部扩展模块,那么您还需要确保已使用此方法构建Python。

目标Python版本

用于指定您要定位的Python版本。

目标PyQt版本

用于指定应用程序是PyQt4或PyQt5应用程序。 如果应用程序不使用PyQt,则忽略此项。

使用控制台(Windows)

is checked if the application should use a console. Specifically it adds

console to the value of CONFIG in the generated .pro file and

only affects Windows applications. Normally this is handled automatically

and a console is used only if the application does not use any GUI related

PyQt module. However it may be usefull during testing of deployed GUI

applications to ensure that tracebacks (e.g. about missing modules) are

captured and displayed.

应用程序包(macOS)

is checked if the application should be built as a bundle and only affects

macOS targets. It would normally be unchecked for command line (i.e.

non-GUI) applications.

应用程序包目录

contains the hierachy of files and directories that implement the

application package and any associated data. It is populated by clicking

the Scan… button. Each file or directory can then be checked if it

is to be included in the package. Note that if the main script file is a

part of the application package then it’s entry must be explicitly

unchecked (i.e. excluded).

The demo includes a copy of it’s source file which is read (when using

Python v3.7.0 or later) using the importlib.resources module.

This is stored in the data directory. This directory must be a Python

package and so it contains an empty __init__.py file. The source file

is given a .dat extension so that it doesn’t appear to be a Python

source file to pyqtdeploy-build. If we didn’t do this then the

source file would be replaced by its frozen version.

扫描...

is clicked to specify the name of the directory containing the Python

package that implements the application. (If the application consists of a

single script then you would not use this.) The hierachy will be scanned

for all files and directories that don’t match any of the specified

exclusions and will be displayed in the Application Package Directory.

移除所有

is clicked to remove all the scanned files and directories.

包括所有

is clicked to check all scanned files and directories so that they are

included in the application package.

排除所有

is clicked to uncheck all scanned files and directories so that they are

excluded from the application package.

排除

is used to specify the list of glob-style patterns that are applied to

the scanned files and directories. Those items that match are then

completely ignored. To edit the list just double-click on the entry to

modify or delete. To add a new entry just double-click the list after the

last entry.