pyinstaller打包超过1个文件

时间:2019-07-21 15:54:03

标签: python-3.6 pyinstaller

我刚刚学习了如何使用相对路径通过pyinstaller打包映像,但是我不知道如何打包多个文件。

我的脚本如下:

import sys
import os
from PIL import Image

def resource_path(relative_path):
    if hasattr(sys, '_MEIPASS'):
        return os.path.join(sys._MEIPASS, relative_path)
    return os.path.join(os.path.abspath("."), relative_path)

image = Image.open(resource_path('First.png'))
image.show()
image2 = Image.open(resource_path('Second.png'))
image2.show()

上面的Script.py效果很好。然后执行如下的cmd:

pyinstaller.exe -F -w --add-data "./First.png;.","./Second.png;." Script.py

我知道问题应该出在cmd代码中,但是我不知道如何重写语法。

有什么想法吗?预先感谢。

劳伦斯

0 个答案:

没有答案
相关问题