Adding a data file in Pyinstaller using the onefile option

后端 未结 4 1052
感情败类
感情败类 2020-12-05 20:37

I\'m trying to add an image to the one file produced by Pyinstaller. I\'ve read many questions/forums like this one and that one and still it\'s not working.

I know

4条回答
  •  一个人的身影
    2020-12-05 21:09

    a simpler way of accessing the temp folder if by doing this:

    bundle_dir = getattr(sys, '_MEIPASS', path.abspath(path.dirname(__file__)))
    data_path = os.path.abspath(path.join(bundle_dir, 'data_file.dat'))
    

    Got it from read the docs

提交回复
热议问题