excel解析用的库为:openpyxl,安装方式为:pip install openpyxl ;项目地址为:https://openpyxl.readthedocs.io/en/stable/
解析unity3d 中的文件用到的库为:unityparser,安装方式为:pip install unityparser ;项目地址为:https://github.com/socialpoint-labs/unity-yaml-parser
将py文件打包成exe文件用到的库为:pyinstaller ,安装方式为:pip install pyinstaller ;项目地址为:https://github.com/pyinstaller/pyinstaller
pyinstaller 常用命令行:pyinstaller --clean -F xxx.py --onefile --icon=xxx.ico --noconsole --name GameUE_cpp.exe
pyinstaller --clean -F gui/main.py --onefile --paths=./ (--paths 包含的路径)
--add-data 使用方式:
windows: 文件路径;使用路径
mac : 文件路径:使用路径
Window下打包指令:
pyinstaller --clean -F huaweiyun_oss_processor.py --onefile --paths=./ --add-data "obsutil.exe;."
Mac下打包指令:
pyinstaller --clean -F huaweiyun_oss_processor.py --onefile --paths=./ --add-data "obsutil:."
在程序中可以这样取 exe 路径:
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
base_path =getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
return os.path.join(base_path, relative_path)
if os.sys.platform =="win32":
UPLOAD_TOOL = resource_path('obsutil.exe')# 上传CDN 工具
else:
UPLOAD_TOOL = resource_path('obsutil')# 上传CDN 工具
取当前路径的方法如下:
# Calculate the relative path to the executable# 根据应用程序的运行方式确定基本路径
if getattr(sys, 'frozen', False):
# 如果应用程序作为一个包运行,sys.executable是可执行文件的路径
base_path = os.path.dirname(sys.executable)
else: # 否则,它就是一个正常运行的Python脚本
base_path = os.path.dirname(os.path.abspath(__file__))
relative_executable_path = os.path.join(base_path, 'GameUE_cpp/Binaries/Win64/GameUE_cpp-Win64-Shipping.exe')
python参数解析库:click ,安装方式为:pip install click ;项目地址为: https://github.com/pallets/click