Pyinstaller在python脚本中的使用

Pyinstaller在python脚本中的使用,python,python-3.x,pyinstaller,Python,Python 3.x,Pyinstaller,在Doc/google中找不到答案 是否可以使用pyinstaller使用python脚本生成构建?或者,唯一正确的选项是通过子流程模块执行命令行命令,例如: from subprocess import PIPE, run, run(['pyinstaller', '--onefile', 'file.py'], stdout=PIPE, stderr=PIPE, universal_newlines=True, timeout=20) 我想做的事情的伪代码: from pyinstall

在Doc/google中找不到答案

是否可以使用pyinstaller使用python脚本生成构建?或者,唯一正确的选项是通过
子流程
模块执行命令行命令,例如:

from subprocess import PIPE, run,

run(['pyinstaller', '--onefile', 'file.py'], stdout=PIPE, stderr=PIPE, universal_newlines=True, timeout=20)
我想做的事情的伪代码:

from pyinstaller import PyInstaller

build = PyInstaller.build('file.py', onefile=true, distpath=*path*, workpath=*path*)
file_path = build.get_path()

我为您做了一些研究,所以:这是不必要的困难,但有一个解决方案:模块,它可以在代码中直接调用。这里有一个教程,可以教你一些有用的东西: