from PyInstaller.__main__ import run import os # Replace 'your_script.py' with the entry point script of your PyQt application script_name = 'main.py' Version = '2.1.3' output_name = f'OPT-{Version}' # 获取当前脚本的目录 current_dir = os.path.dirname(os.path.abspath(__file__)) options = [ '--onefile', # Create a single executable file '--hidden-import=winshell', f'--add-data={os.path.join(current_dir, "D:/project/py/opt-gitee", "Lib", "site-packages", "winshell.py")};winshell', f'--add-data={os.path.join(current_dir, "dm")};dm', f'--name={output_name}', # Specify the output file name ] datas = [ ('path/to/plugin_file', 'destination_folder') ] run([script_name] + options)