我创造了
exe
使用以下代码
pyinstaller -F --add-data "installation.zip;installation" phpfilescopy_extract.py --console --onefile
我已经用下面的代码解压了zip文件。
Sys.yMeiPase-给出了我以前使用的临时EXE提取路径
找到zip文件并从路径中提取
def excute(self):
global src
#source = src
dst = 'd:/destination'
# sys._MEIPASS - gives the temporary exe extraction path that i used to locate the zip files and extracted from the path
source = sys._MEIPASS + "/installation/installation.zip"
if os.path.exists(dst):
if source.endswith('.zip'):
file_zip = zipfile.ZipFile(source)
file_zip.extractall(dst)
QMessageBox.about(self, "Title", "all file's extracted")
else:
QMessageBox.about(self, "Title", "failed extract file")
else:
QMessageBox.about(self, "Title", "path not vialed ")