pyinstall使用
python -m pip install -i pyinstall https://pypi.tuna.tsinghua.edu.cn/simple
C:\Python310\Scripts\pyinstaller.exe -w -F --add-data "D:\work\dcc_scripts\standalone\batch_tools\icon;./icon" "D:\work\dcc_scripts\standalone\batch_tools\check_anim_reference_path.py"
def getWorkPath():
if sys.argv[0]:
path = os.path.dirname(sys.argv[0])
else:
path = os.path.dirname(__file__)
return path
打包的文件与main.py放在一起,通过getWorkPath获取绝对路径,然后加上相对路径