是否可以在 pyinstaller 生成的 spec 文件中写入 python 代码?
Is it possible to write python code in spec file which is generated by pyinstaller?
有一些命令必须用规范文件执行。是否有可能在规范文件中包含命令。
我必须执行以下语句:
rm -rf build dist
我需要包含在规范文件中。
当我运行
pyinstaller --clean abc.spec
它必须删除构建文件夹和 dist 文件夹
来自 pyinstaller 文档:
The spec file tells PyInstaller how to process your script. It encodes the script names and most of the options you give to the pyinstaller command. The spec file is actually executable Python code. PyInstaller builds the app by executing the contents of the spec file.
因此,您可以在规范文件中包含 python 代码来执行您想要的操作。但它需要是 python 代码,而不是你拥有的终端命令。
有一些命令必须用规范文件执行。是否有可能在规范文件中包含命令。
我必须执行以下语句:
rm -rf build dist
我需要包含在规范文件中。
当我运行
pyinstaller --clean abc.spec
它必须删除构建文件夹和 dist 文件夹
来自 pyinstaller 文档:
The spec file tells PyInstaller how to process your script. It encodes the script names and most of the options you give to the pyinstaller command. The spec file is actually executable Python code. PyInstaller builds the app by executing the contents of the spec file.
因此,您可以在规范文件中包含 python 代码来执行您想要的操作。但它需要是 python 代码,而不是你拥有的终端命令。