标签:tieba rda AC favicon blank log icon 还需要 install
def resource_path(self, relative): if hasattr(sys, "_MEIPASS"): return os.path.join(sys._MEIPASS, relative) return os.path.join(relative) def copy_GUI(self): root = tkinter.Tk() root.title("U盘拷贝小工具 v6.0") root.geometry("400x260") icopath = self.resource_path(r"D:\python_workshop\python6\personal_practices\favicon-20180501101520441.ico") if os.path.exists(icopath): root.iconbitmap(icopath)
以上红色代码为需要增加的代码
此外,还需要修改打包的spec文件,在在a.datas,下面添加 [(‘favicon-20180501101520441.ico‘,‘D:\\python_workshop\\python6\\personal_practices\\favicon-20180501101520441.ico‘,‘DATA‘)]。InI
再重新通过PyInstaller -i D:\python_workshop\python6\personal_practices\favicon-20180501101520441.ico -w D:\python_workshop\python6\personal_practices\udisk_copy v6.0.py打包。然后运行,发现一切ok
参考:
https://blog.csdn.net/you227/article/details/46989625
http://tieba.baidu.com/p/3060401749
解决: PyInstaller打包后exe文件打开时出现failed to execute script
标签:tieba rda AC favicon blank log icon 还需要 install
原文地址:https://www.cnblogs.com/cnhkzyy/p/8978062.html