我正在尝试使用构建选项制作 Tkinter GUI 模块,以便在用户输入一些输入后构建 Exes,我不希望他安装 python 和 pyinstaller 以便能够将代码编译为 Exe。
使用 Python 3.6.0
我制作了 2 个 python 脚本,名字分别是 compiler.py 和其他 hello.py hello.pyprint("Hello World")
编译器.py
import PyInstaller.__main__
import ctypes
import win32ctypes
from win32ctypes import pywin32
from win32ctypes.pywin32 import pywintypes
import os
def compiling():
PyInstaller.__main__.run([
# '--name=%s' % package_name,
'--onefile',
'--windowed',
# '--add-binary=%s' % os.path.join('resource', 'path', '*.png'),
# '--add-data=%s' % os.path.join('resource', 'path', '*.txt'),
# '--icon=%s' % os.path.join('resource', 'path', 'icon.ico'),
os.path.join('hello.py'), # my_package is a Directory
# '--version-file=%s' % os.path.join('assembly.txt'),
])
compiling() …Run Code Online (Sandbox Code Playgroud)